Gemini532
asked on
String or binary data would be truncated
Hello Everyone I get the following error message:
Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.
/OPICForms/115/save_sv.asp , line 163
Is this caused by my code or by the datatyeps in my database?
For instance, if I hava a string it's too long to fit in the database?
if it's caused by my code, please let me know and I'll include the code, it's just that this is 14 page application and the error seems to come from the UPDATE statmetn, which doesn't tell me anything:
if sUpdate<> "" then
sUpdate = "UPDATE " & sTable & " SET " & sUpdate & " [Part" & iFormPart & "Complete]=" & Request.Form("_complete") & ", [Part" & iFormPart & "Updated_ts]='" & now() & "' WHERE FK_ApplicationID=" & iApplicationID
else
sUpdate = "UPDATE " & sTable & " SET [Part" & iFormPart & "Complete]=" & Request.Form("_complete") & ", [Part" & iFormPart & "Updated_ts]='" & now() & "' WHERE FK_ApplicationID=" & iApplicationID
end if
objConn.execute(sUpdate)
end if
Any ideas?
Here is the UPDATE if I do response.write:
UPDATE tableName SET [chkFI]='1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [Technical1]=NULL, [Technical2]=NULL, [TrainingManagement]='0', [TrainingProfessional]='0' , [TrainingLabor]='0', [EmployPolicy]=0, [Years]='0', [Managerial1]=NULL, [UnskilledLabor1]=NULL, [Managerial2]=NULL, [UnskilledLabor2]=NULL, [Partnerships]=0, [WomenBenefits]=0, [BenefitPoor]=0, [CompanyBenefits]=0, [DescribePartnerships1]=NU LL, [DescribePartnerships2]=NU LL, [DescribePartnerships3]=NU LL, [DescribePartnerships4]=NU LL, [chkbenefits]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [chkBenefitPoor]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [chkCompanyBenefits]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [chkEmployPolicy]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [chkWomenBenefits]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [chkPartnerships]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [Part09Complete]=0, [Part09Updated_ts]='11/16/ 2007 11:43:37 AM' WHERE FK_ApplicationID=995
It seems to have strange data like chkEmployPolicy = 0, is it because with several answers it sets up a string like this [chkCompanyBenefits]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0',
How do I fix somethign like this?
How can somethign like this happen, it's coming from the checkbox question, but why? why have the name equal to 0 rather than just 0
Microsoft OLE DB Provider for ODBC Drivers error '80040e57'
[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.
/OPICForms/115/save_sv.asp
Is this caused by my code or by the datatyeps in my database?
For instance, if I hava a string it's too long to fit in the database?
if it's caused by my code, please let me know and I'll include the code, it's just that this is 14 page application and the error seems to come from the UPDATE statmetn, which doesn't tell me anything:
if sUpdate<> "" then
sUpdate = "UPDATE " & sTable & " SET " & sUpdate & " [Part" & iFormPart & "Complete]=" & Request.Form("_complete") & ", [Part" & iFormPart & "Updated_ts]='" & now() & "' WHERE FK_ApplicationID=" & iApplicationID
else
sUpdate = "UPDATE " & sTable & " SET [Part" & iFormPart & "Complete]=" & Request.Form("_complete") & ", [Part" & iFormPart & "Updated_ts]='" & now() & "' WHERE FK_ApplicationID=" & iApplicationID
end if
objConn.execute(sUpdate)
end if
Any ideas?
Here is the UPDATE if I do response.write:
UPDATE tableName SET [chkFI]='1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0', [Technical1]=NULL, [Technical2]=NULL, [TrainingManagement]='0', [TrainingProfessional]='0'
It seems to have strange data like chkEmployPolicy = 0, is it because with several answers it sets up a string like this [chkCompanyBenefits]='0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0',
How do I fix somethign like this?
How can somethign like this happen, it's coming from the checkbox question, but why? why have the name equal to 0 rather than just 0
Most of the time when I get this error, I am trying to put too much data into a field in my database that won't hold that much data.
A solution that I use is I always trim my fields by using the mid function to only accept the maximum number of character allowed in my field in SQL Server.
So if you had a field in your table that only allowed 30 characters, just use the mid(myfield,1,30) to make sure you are only allowing the correct number of bytes.
Also, create maximum sizes on your form input fields so you won't all the user to exceed the entry there either.
So if you had a field in your table that only allowed 30 characters, just use the mid(myfield,1,30) to make sure you are only allowing the correct number of bytes.
Also, create maximum sizes on your form input fields so you won't all the user to exceed the entry there either.
If you are using chexkboxes you need to test the results by a javascript like this to see what was selected in your checkboxes:
for (counter=0;counter<job_for m.chkjob.l ength;coun ter++)
{
if (job_form.chkjob[counter]. checked)
{
chkbox_choices = chkbox_choices + 1;
}
}
It looks like you are bringing in all of your values for the form checkbox instead of the one you actually want, that is why you have so many numbers in your string.
for (counter=0;counter<job_for
{
if (job_form.chkjob[counter].
{
chkbox_choices = chkbox_choices + 1;
}
}
It looks like you are bringing in all of your values for the form checkbox instead of the one you actually want, that is why you have so many numbers in your string.
ASKER
but multiple checkboxes are checked, therefore there shoudl be mulitple values.. .no?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.