Hi, I'm having quite a confusing problem using LabSQL to talk to a MySQL database. I've seen a similar question on this forum, but I've got it working, but it's unrepeatable.
LabVEW 8.0 Pro, Windows XP Pro, LabSQL, MySQL has a database with 3 tables created in it.
I'm looping through some directories.
Then looping through a lot of text files in the directory.
Create the ADO connection
Open the connection to the ADO
Check to see if that file has been entered yet
If not I parse the file and INSERT some information into a table which creates a new record
Use the "SELECT @@IDENTITY;" command to get the id of that record
Use that id to reference the two other tables and populate them (if required)
Close the ADO connection
Destroy the ADO connection
Then move on to the next file
And then move on to the next directory.
And as long as the db is empty in the first place this works fine
However, if I run the whole process again, after about half a dozen directories and thousands of files I get the error-
"Error -2146824584 occured at Exception occured in ADODB.connection: Operation is not allowed when object is closed" when it tries to open the connection, having created it without errors!
I thought this might be because I was creating and destroying the ADO connection each time, so I decided to create the connection at the begining of each new directory. and this seemed to fix the problem because I could now rescan the db.
However now something stranger happens.
If I empty the db and start again, I start getting SQL errors. Basically after a while the ADO Recordset Get String starts returning nothing (But not always!!!) It will refuse to execute the SELECT @@IDENTITY command because it says the record doesn't exist (Even though it has just inserted that record)
And ADO functions start failing all over the place, sometimes without generating an error at all.