Term56
asked on
String or binary data would be truncated -- Question
I know the general reason this happens. But it makes no sense why it is happening to me. I have a .net app I developed on a windows xp machine. I created a package, and deployed it to win2k/win2k3 -- and for some reason when I run it on that box, which manipulates the same database, and does the same insert/update it fails. Could it be a dll issue ?
I know for a fact the string is well formed and the database contains the correct columns, because it works on my xp box. Any suggestions ?
this is what I get :
[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
System.Data.SqlClient.SqlC onnection. OnError(Sq lException exception, Boolean breakConnection) +857242
System.Data.SqlClient.SqlI nternalCon nection.On Error(SqlE xception exception, Boolean breakConnection) +734854
System.Data.SqlClient.TdsP arser.Thro wException AndWarning (TdsParser StateObjec t stateObj) +188
System.Data.SqlClient.TdsP arser.Run( RunBehavio r runBehavior, SqlCommand cmdHandler, SqlDataReader dataStream, BulkCopySimpleResultSet bulkCopyHandler, TdsParserStateObject stateObj) +1838
System.Data.SqlClient.SqlC ommand.Run ExecuteNon QueryTds(S tring methodName, Boolean async) +192
System.Data.SqlClient.SqlC ommand.Int ernalExecu teNonQuery (DbAsyncRe sult result, String methodName, Boolean sendToPipe) +380
System.Data.SqlClient.SqlC ommand.Exe cuteNonQue ry() +135
vt_enhancements.WebForm1.b tnUpdate_C lick(Objec t sender, EventArgs e) +1900
System.Web.UI.WebControls. Button.OnC lick(Event Args e) +105
System.Web.UI.WebControls. Button.Rai sePostBack Event(Stri ng eventArgument) +107
System.Web.UI.WebControls. Button.Sys tem.Web.UI .IPostBack EventHandl er.RaisePo stBackEven t(String eventArgument) +7
System.Web.UI.Page.RaisePo stBackEven t(IPostBac kEventHand ler sourceControl, String eventArgument) +11
System.Web.UI.Page.RaisePo stBackEven t(NameValu eCollectio n postData) +33
System.Web.UI.Page.Process RequestMai n(Boolean includeStagesBeforeAsyncPo int, Boolean includeStagesAfterAsyncPoi nt) +5102
I know for a fact the string is well formed and the database contains the correct columns, because it works on my xp box. Any suggestions ?
this is what I get :
[SqlException (0x80131904): String or binary data would be truncated.
The statement has been terminated.]
System.Data.SqlClient.SqlC
System.Data.SqlClient.SqlI
System.Data.SqlClient.TdsP
System.Data.SqlClient.TdsP
System.Data.SqlClient.SqlC
System.Data.SqlClient.SqlC
System.Data.SqlClient.SqlC
vt_enhancements.WebForm1.b
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.WebControls.
System.Web.UI.Page.RaisePo
System.Web.UI.Page.RaisePo
System.Web.UI.Page.Process
My first guess would be to check the MDAC version?
ASKER
hmm, good idea, let me check
ASKER
ok, my dev box has 2.8 SP1, the release box has 2.8 SP2.
Installe sp2 on mine and recompile ?
Installe sp2 on mine and recompile ?
ASKER
Is there even a version of 2.8sp2 for windows xp ? looks like it is only for windows 2003
ASKER
on win2k = 2.8 RTM
on win2k3 = 2.8 SP2
on dev box = 2.8 SP1
on win2k3 = 2.8 SP2
on dev box = 2.8 SP1
Try psoting the relevant code and structure of the table(s) and we can point out the error.
Also, please follow-up on this old abandoned question:
https://www.experts-exchange.com/questions/21804384/need-help-disabling-a-client-side-button-before-the-server-side-fires.html
https://www.experts-exchange.com/questions/21804384/need-help-disabling-a-client-side-button-before-the-server-side-fires.html
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
I understand the usual case. But I can assure you it is not an issue in relation to the code/tables. It works perfectly fine on my dev box, and I have been able to get it working on a test enviornment. I checked the mdac and versions of the framework and all three have the current versions needed.
It has something to do with the server and/or deployment.
It has something to do with the server and/or deployment.
Let us know when you find the bug.
ASKER
I unfortunately have not been able to find an answer. I am rebuilding a new web server and hopefully the problem will go away. I dont know how to handle this ticket, as I dont think it should PAQ'ed -- wont help anyone else.
>>I dont think it should PAQ'ed -- wont help anyone else.<<
As everyone has pointed out the error message is self-explanatory. See here:
What are my choice?
https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi67
As everyone has pointed out the error message is self-explanatory. See here:
What are my choice?
https://www.experts-exchange.com/Databases/Microsoft_SQL_Server/help.jsp#hi67
FWIW - I started getting this error today after running perfectly fine for months. Turns out I had a table with two varchar(max) columns. Don't know what caused it, but today the first column was still varchar(max) however the second column had been converted to a varchar(1). For now I set both to varchar(6000) and it is working, but if it breaks again I guess I'll have to split the columns into two tables.
It should also be pointed out that this is a GoDaddy shared SQL2005 installation.
It should also be pointed out that this is a GoDaddy shared SQL2005 installation.