Click here to Skip to main content
15,888,325 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I got this error:
string or binary data would be truncated. the statement has been terminated.in asp.net.

I don't know anything of this type of error.
size of the column of the table is varchar(max).

and my query is :
C#
update ACC_APP1_Van set Registration_No='459852',Chesis_No='874525',DOB='25/10/2001', Driver_Name='rohit', Contact_No='8574859684', Alternate_Contact_No='2541639685', State='up', Residential_Address='noida', Permanent_Address='ghaziabad', Pincode='201009',CNG_Complience_No='65412`',Owner_Name='jeevesh',Owner_Address='noida',Owner_Contact_No='8596857485', Blood_Group='Select',  Max_Speed='', Insurance_No='2145', Insurance_Company='icici', UpdatedOn='29-Jul-13 12:00:00 AM' where Van_Id='V00001'




thanks in advance
Posted
Updated 29-Jul-13 1:56am
v2
Comments
Joezer BH 29-Jul-13 7:17am    
Which one is Varchar? all of them?
Check ALL your columns to see if they can contain the length of your data.
Adarsh chauhan 29-Jul-13 7:34am    
I agree with Maimonides... Check all your columns datatype..
well, i have doubt in " Blood_Group='Select' "
see what length you have given for this.. I am saying because if i would design table then I will choose char(3) to store like 'B+','AB+', and in this case 'select' cant be stores in that column.
ridoy 29-Jul-13 7:58am    
good point,agree with @chauhan
Adarsh chauhan 30-Jul-13 2:00am    
Thanks Ridoy.
without knowing the exact table structure and code we can't exactly say which column is causing this error, so only answer could be " check all columns in your table and supplied data" or we can make only guesses
:)
Maciej Los 29-Jul-13 8:25am    
Check below fields data type:
Registration_No='459852'
Chesis_No='874525',
Contact_No='8574859684',
Alternate_Contact_No='2541639685',
Pincode='201009',
CNG_Complience_No='65412`',
Owner_Contact_No='8596857485',
Max_Speed='',
Insurance_No='2145'

Doesn't it should be a numeric data types ;)

1 solution

Hello Rashid Choudhary,
Please check all columns in your table. This error comes when you try to insert long data and database contain limited size.
So verify again your table.
 
Share this answer
 
Comments
Maciej Los 29-Jul-13 8:19am    
I don't know why someone dwon-vote this answer. It's correct!
+5!
Adarsh chauhan 30-Jul-13 1:59am    
I agree... This is the correct answer..This type of error comes when you try to insert long size data in lesser capacity column.
without knowing the exact table structure and code we can't exactly say which column is causing this error, so only answer could be " check all columns in your table and supplied data" or we can make only guesses. so +5 from my side also..

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900