Click here to Skip to main content
15,888,984 members
Home / Discussions / ASP.NET
   

ASP.NET

 
GeneralRe: Html to PDF Pin
Mohammed Hameed19-May-13 20:46
professionalMohammed Hameed19-May-13 20:46 
Questionasp.net with silverlight Pin
junkyy15-May-13 11:01
junkyy15-May-13 11:01 
AnswerRe: asp.net with silverlight Pin
ZurdoDev21-May-13 10:28
professionalZurdoDev21-May-13 10:28 
QuestionChat Box Component Pin
Member 1005410915-May-13 2:33
Member 1005410915-May-13 2:33 
AnswerRe: Chat Box Component Pin
Jasmine250115-May-13 4:58
Jasmine250115-May-13 4:58 
AnswerRe: Chat Box Component Pin
Thomas Daniels15-May-13 5:36
mentorThomas Daniels15-May-13 5:36 
QuestionWebMatrix, SQL Compact and Windows Azure Pin
Ranger4914-May-13 3:28
Ranger4914-May-13 3:28 
QuestionDatabase Error Pin
<<Tash18>>14-May-13 3:17
<<Tash18>>14-May-13 3:17 
Hi,
I have developed an ASP.net VB application on 1.1 in which we insert certain data into a particular table which is on sybase.
My table structure:
CREATE TABLE dbo.at_ip_disbursement
(
doc_id numeric(7,0) IDENTITY,
doc_type varchar(30) NOT NULL,
rim_no int NOT NULL,
item_type varchar(80) NULL,
customer_name varchar(80) NOT NULL,
rsm_name varchar(80) NOT NULL,
branch_no int NULL,
business_unit varchar(30) NOT NULL,
input_dt datetime NOT NULL,
Category varchar(30) NULL,
deferral_details nvarchar(600) NULL,
days_deferred int NULL,
Deff_Expdt datetime NOT NULL,
Deferred_Dt datetime NULL,
rm_comments nvarchar(600) NULL,
creator_id varchar(10) NULL,
modifier_id varchar(10) NULL,
status char(1) NOT NULL,
App_Authority nvarchar(600) NULL
)
LOCK ALLPAGES
go
IF OBJECT_ID('dbo.at_ip_disbursement') IS NOT NULL
PRINT '<<< CREATED TABLE dbo.at_ip_disbursement >>>'
ELSE
PRINT '<<< FAILED CREATING TABLE dbo.at_ip_disbursement >>>'
go

Now the piece of code where the insert takes place:

Public Shared Function AddDisbursement(ByVal DocType As String, ByVal Rim As Int32, ByVal CustomerName As String, ByVal RSMName As String, ByVal BranchNo As Int32, ByVal Business As String, ByVal InputDate As String, ByVal Category As String, ByVal DeferralDetails As String, ByVal DeferredDays As String, ByVal DefExpDate As String, ByVal DefDate As String, ByVal RMComments As String, ByVal CreatorId As String, ByVal App_Authority As String, ByVal Item As String) As String
        Dim logger As SKLogger = New SKLogger
        Dim connMosaic As String = System.Web.HttpContext.Current.Session("connStr").ToString()
        Dim cmdText As String

        cmdText = "INSERT INTO at_ip_disbursement(" & _
                    "doc_type, " & _
                    "rim_no, " & _
                    "customer_name, " & _
                    "rsm_name, " & _
                    "branch_no, " & _
                    "business_unit, " & _
                    "input_dt, " & _
                    "Category, " & _
                    "deferral_details, " & _
                    "days_deferred, " & _
                    "Deff_Expdt, " & _
                    "Deferred_Dt, " & _
                    "rm_comments, " & _
                    "creator_id, " & _
                    "status, " & _
                    "App_Authority, " & _
                    "item_type) " & _
                "VALUES (" & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "?," & _
                    "'A'," & _
                    "?," & _
                    "?)"

        Dim conn As OdbcConnection = New OdbcConnection(connMosaic)
        Dim cmd As OdbcCommand = New OdbcCommand(cmdText, conn)

        cmd.Parameters.Add("@DocType", OdbcType.VarChar).Value = DocType
        cmd.Parameters.Add("@Rim", OdbcType.Int).Value = Rim
        cmd.Parameters.Add("@CustomerName", OdbcType.VarChar).Value = CustomerName
        cmd.Parameters.Add("@RSMName", OdbcType.VarChar).Value = RSMName
        cmd.Parameters.Add("@BranchNo", OdbcType.Int).Value = BranchNo
        cmd.Parameters.Add("@Business", OdbcType.VarChar).Value = Business
        cmd.Parameters.Add("@InputDate", OdbcType.Date).Value = InputDate
        cmd.Parameters.Add("@Category", OdbcType.VarChar).Value = Category
        cmd.Parameters.Add("@DeferralDetails", OdbcType.VarChar).Value = GetNull(DeferralDetails)
        cmd.Parameters.Add("@DeferredDays", OdbcType.Int).Value = DeferredDays
        cmd.Parameters.Add("@DefExpDate", OdbcType.Date).Value = DefExpDate
        cmd.Parameters.Add("@DefDate", OdbcType.Date).Value = GetNull(DefDate)
        cmd.Parameters.Add("@RMComments", OdbcType.VarChar).Value = GetNull(RMComments)
        cmd.Parameters.Add("@CreatorId", OdbcType.VarChar).Value = GetNull(CreatorId)
        cmd.Parameters.Add("@App_Authority", OdbcType.VarChar, 1200).Value = GetNull(App_Authority)
        cmd.Parameters.Add("@Item", OdbcType.VarChar).Value = GetNull(Item)

        Try
            conn.Open()
            cmd.ExecuteNonQuery()
        Catch ex As Exception
            logger.LogException("AddDisbursement", ex.ToString())
            AddDisbursement = ex.Message
        Finally
            cmd.Dispose()
            conn.Close()
        End Try

        'Return True
    End Function


Now through javascript i allow user to input only 500 Characters(which works perfectly). Once the user submits data (say for example 400 characters) which is under the field "App_Authority" i get the following error:

ERROR [HY000] [INTERSOLV][ODBC SQL Server driver][SQL Server]ct_param(): user api layer: external error: A data length of 399 exceeds the maximum length allowed for CHAR data.

The same happens when i try to insert data into fields "RMComments" and "DeferralDetails"

Kindly advise me.
Thanks in Advance
AnswerRe: Database Error Pin
jkirkerx14-May-13 7:57
professionaljkirkerx14-May-13 7:57 
Questionhow to add hot keys to ASP.NET MVC application? Pin
manoj.jsm13-May-13 23:05
manoj.jsm13-May-13 23:05 
AnswerRe: how to add hot keys to ASP.NET MVC application? Pin
Jasmine250115-May-13 4:59
Jasmine250115-May-13 4:59 
GeneralRe: how to add hot keys to ASP.NET MVC application? Pin
manoj.jsm15-May-13 21:17
manoj.jsm15-May-13 21:17 
Questionadding two datatables..columnwise Pin
Anuraag113-May-13 20:19
Anuraag113-May-13 20:19 
AnswerRe: adding two datatables..columnwise Pin
Jasmine250114-May-13 6:33
Jasmine250114-May-13 6:33 
GeneralRe: adding two datatables..columnwise Pin
Anuraag114-May-13 21:55
Anuraag114-May-13 21:55 
GeneralRe: adding two datatables..columnwise Pin
Jasmine250115-May-13 4:50
Jasmine250115-May-13 4:50 
GeneralRe: adding two datatables..columnwise Pin
Anuraag115-May-13 20:54
Anuraag115-May-13 20:54 
GeneralRe: adding two datatables..columnwise Pin
Jasmine250116-May-13 5:36
Jasmine250116-May-13 5:36 
QuestionLog in ASP.NET Pin
duong ba phuc13-May-13 16:39
duong ba phuc13-May-13 16:39 
QuestionRe: Log in ASP.NET Pin
Sandeep Mewara13-May-13 19:04
mveSandeep Mewara13-May-13 19:04 
AnswerRe: Log in ASP.NET Pin
duong ba phuc13-May-13 20:30
duong ba phuc13-May-13 20:30 
SuggestionRe: Log in ASP.NET Pin
Bikash Prakash Dash13-May-13 19:07
Bikash Prakash Dash13-May-13 19:07 
GeneralRe: Log in ASP.NET Pin
duong ba phuc13-May-13 20:30
duong ba phuc13-May-13 20:30 
GeneralRe: Log in ASP.NET Pin
Bikash Prakash Dash13-May-13 20:37
Bikash Prakash Dash13-May-13 20:37 
GeneralRe: Log in ASP.NET Pin
duong ba phuc14-May-13 2:22
duong ba phuc14-May-13 2:22 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.