Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Invalid string or buffer length 1

Status
Not open for further replies.

bigozz

Programmer
Apr 12, 2001
39
GB
When using Visual Basic to connect to a MySQL database using ODBC v2.50.37, I receive the error 'Invalid string or buffer length' when trying to write to any BLOB or CHAR field. Any Ideas?
 
I've also encountered the same problem using vbscript in an ASP application. Any update to the database via ADO, regardless of field type (eg. integer, string, etc.), fails.

I would be interested to know if anyone has managed to get MySQL working with ADO.
 
You would not beleive it, I have actually managed to get it working!

I have written a client app in VB to update a MySQL database on the web using ADO, I had to use two connections, one to upload, one to download, due to some very iffy ODBC settings.

If you want the code, let me know.

I'd love to know why there is so little information on the ODBC/ADO stuff. Are windows programmers a dying breed?

bigozz@hotmail.com
 
Yes, I would like to see a sample piece of code. Also, could you let me know what ODBC settings you were using?
 
The problem lies with the way in which the ODBC driver handles strings, if you try to write a string to a field which is longer than any of the strings already in the field, you get the 'Invlaid buffer....' message. Just set the 'Don't optimize column width' option on the driver.

Evan after doing this, I still had to use two connection objects, one for upload and one for download. The download connection did not have the 'optimize column width' option set, as it seemed to corrupt the data.

Hope this helps, if you still can't master it then let me know, and I'll post the code.
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top