Andrew Herrmann
May 2nd, 2000, 02:10 AM
A few days ago, I posted a problem that I was having with a strange error. I've done a little more investigating and maybe what I've found will be enough for somebody to help me out...
I'm using MySQL and the following VB Code:
------- CODE HERE -------
selStmt = "SELECT * FROM customer;"
recset1.Open selStmt, cnn1, adOpenKeyset, adLockPessimistic
With recset1
.AddNew
.Fields("cust_name") = CustomerName
.Fields("contact_name") = ContactName
.Update
.Requery
.MoveLast
.Close
End With
------ CODE ENDS ---------
I was getting an error when the length of the data that I was adding to a field exceeded a certain size. I decided to look at the field type and field defined size. What I discovered was that the field defined size was set to the size of the largest existing field.
The field is defined as a varchar of length 40 -- This shows up properly on MySQL and in Access. I'm guessing that when I do my query, VB makes the fields only as large as they need to be.
Unfortunately, if I want to add a string that is larger than one of the existing strings, the program will bomb. Has anyone run into this problem before and/or know how to solve it?
Thanks..
I'm using MySQL and the following VB Code:
------- CODE HERE -------
selStmt = "SELECT * FROM customer;"
recset1.Open selStmt, cnn1, adOpenKeyset, adLockPessimistic
With recset1
.AddNew
.Fields("cust_name") = CustomerName
.Fields("contact_name") = ContactName
.Update
.Requery
.MoveLast
.Close
End With
------ CODE ENDS ---------
I was getting an error when the length of the data that I was adding to a field exceeded a certain size. I decided to look at the field type and field defined size. What I discovered was that the field defined size was set to the size of the largest existing field.
The field is defined as a varchar of length 40 -- This shows up properly on MySQL and in Access. I'm guessing that when I do my query, VB makes the fields only as large as they need to be.
Unfortunately, if I want to add a string that is larger than one of the existing strings, the program will bomb. Has anyone run into this problem before and/or know how to solve it?
Thanks..