rckrch
asked on
Data entry into sql server. string or binary data would be truncated.
I get the following error and I don't know why. I am using sql server and defined my data as nvarchar(10). I am only trying to enter one character in the column and I get the error. I have also tried using char as the data type. I have some null values in the columns.
Can anyone help?
Thanks,
String or binary data would be truncated.
The statement has been terminated.
Can anyone help?
Thanks,
String or binary data would be truncated.
The statement has been terminated.
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Maybe you're inserting the wrong value. double check your code.
ASKER
FRTableConCommand.CommandT ext = "UPDATE FR_CELLCOLOR SET ContBreakPoint=@ContBreakP oint WHERE CustomerConcernNo=@Custome rConcernNo "
FRTableConCommand.Paramete rs("@ContB reakPoint" ).Value = "R"
FRTableConCommand.Paramete rs("@Custo merConcern No").Value = "1004"
FRTableConCommand.ExecuteN onQuery()
"ContBreakPoint" data type is nvarchar(10) in sql server.
The above code gives me the error.
FRTableConCommand.Paramete
FRTableConCommand.Paramete
FRTableConCommand.ExecuteN
"ContBreakPoint" data type is nvarchar(10) in sql server.
The above code gives me the error.
You should be adding the parameters -
FRTableConCommand.CommandText = "UPDATE FR_CELLCOLOR SET ContBreakPoint=@ContBreakPoint WHERE CustomerConcernNo=@CustomerConcernNo"
FRTableConCommand.Parameters.Add("@ContBreakPoint").Value = "R"
FRTableConCommand.Parameters.Add("@CustomerConcernNo").Value = "1004"
FRTableConCommand.ExecuteNonQuery()
-saige-
ASKER
The parameters were added in a previous statement. There parameters are revised for the same update statement because they are in a loop. The loop searches for condition in a grid view across several cells.
I would look at FR_CELLCOLOR in SSMS. Is it a view or table? Does it has an [INSTEAD OF] UPDATE trigger? When it is a view, do the base tables have such triggers?
ASKER
It is not a view it is a table. it does not use an [INSTEAD OF] UPDATE trigger.
Also, I found the issue. As I said with my initial post I have null values in some of the columns in the table. Due to the loop and the condition the procedure is looking for some of the values during the update could also be null. This is when I get the error.
Also, I found the issue. As I said with my initial post I have null values in some of the columns in the table. Due to the loop and the condition the procedure is looking for some of the values during the update could also be null. This is when I get the error.
ASKER
Just increased the nvarchar from 10 to 25. that solved the problem.