'String or binary data would be truncated' error message - Programmers Heaven

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

'String or binary data would be truncated' error message

dilviddilvid Posts: 16Member
Microsoft OLE DB Provider for ODBC Drivers (0x80040E57)
[Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.

This is the full error i get while trying to execute my SQL String. I gather from what I could find on the net that its to do with the length of a certain aspect of the page. Im not sure if its the database fields, the form fields or the length of the data im trying to send accross. Ive tried spliting the SQL String into 2 (StrQ1 and StrQ2) yet i still got the same message. The String im tryin to send accross is the following:

strQ = "INSERT INTO SeekerDetails"
strQ = strQ & " (Username, Password, Title, Firstname, Surname, "
strQ = strQ & " Gender, DateofBirth, AddressLine1, AddressLine2, "
strQ = strQ & "City, County, PostCode, Telephone, Email, Statement, "
strQ = strQ & "JobType, JobSector, SalaryRange, CVOnlineTime)"
strQ = strQ & " VALUES ('" & Username & "', '" & Password & "', '"
strQ = strQ & "" & Title & "', '" & Firstname & "', '" & Surname & ""
strQ = strQ & "', '" & Gender & "', '" & DOB & "', '" & Address1 & ""
strQ = strQ & "', '" & Address2 & "','" & City & "', '" & County & ""
strQ = strQ & "','" & Postcode & "', '" & Tel & "', '" & Email & ""
strQ = strQ & "', '" & Statement & "', '" & Contract & "', '" & Sector & ""
strQ = strQ & "', '" & Range & "', '" & OnlineTime & "')"

Its rather long but this data for the site im building does need to go over on this page. Im rather new to SQL but I am hoping that someone can give me a hint to guide me in the right direction. Does this need to be split up and sent as 3 SQL Strings or is there a way i can make it go over as one.

Comments

  • DaedaliusDaedalius Posts: 30Member
    One of the fields on table SeekerDetails of type varchar/char is being fed data that is too long. i.e. One of the variables that you are using to populate the second part of your string (after the VALUES word) probably contains a string value that is too large for the field that you are trying to plug it into.


    : Microsoft OLE DB Provider for ODBC Drivers (0x80040E57)
    : [Microsoft][ODBC SQL Server Driver][SQL Server]String or binary data would be truncated.
    :
    : This is the full error i get while trying to execute my SQL String. I gather from what I could find on the net that its to do with the length of a certain aspect of the page. Im not sure if its the database fields, the form fields or the length of the data im trying to send accross. Ive tried spliting the SQL String into 2 (StrQ1 and StrQ2) yet i still got the same message. The String im tryin to send accross is the following:
    :
    : strQ = "INSERT INTO SeekerDetails"
    : strQ = strQ & " (Username, Password, Title, Firstname, Surname, "
    : strQ = strQ & " Gender, DateofBirth, AddressLine1, AddressLine2, "
    : strQ = strQ & "City, County, PostCode, Telephone, Email, Statement, "
    : strQ = strQ & "JobType, JobSector, SalaryRange, CVOnlineTime)"
    : strQ = strQ & " VALUES ('" & Username & "', '" & Password & "', '"
    : strQ = strQ & "" & Title & "', '" & Firstname & "', '" & Surname & ""
    : strQ = strQ & "', '" & Gender & "', '" & DOB & "', '" & Address1 & ""
    : strQ = strQ & "', '" & Address2 & "','" & City & "', '" & County & ""
    : strQ = strQ & "','" & Postcode & "', '" & Tel & "', '" & Email & ""
    : strQ = strQ & "', '" & Statement & "', '" & Contract & "', '" & Sector & ""
    : strQ = strQ & "', '" & Range & "', '" & OnlineTime & "')"
    :
    : Its rather long but this data for the site im building does need to go over on this page. Im rather new to SQL but I am hoping that someone can give me a hint to guide me in the right direction. Does this need to be split up and sent as 3 SQL Strings or is there a way i can make it go over as one.
    :
    :

Sign In or Register to comment.