From: turbot on
I am using DB toolkit.
When the attached vi running at odd time, it is ok. But when it run at even time, it will generate error as screenshot.
The related error SQL command is : SELECT DB_ID ('ming07_06_22') ---Check if the same name DB not exist  
The Error message is:
Error 1 occurred at " Conn getDataToModify.vi:1"
Possible reason(s):
Object 0x2222222 is not valid.
What I trying to do is:
1) Check if the same name DB not exist
2) Yes, then restore the DB from a backup file.
3) Finished usage, delete related user and DB (the work for other vi )
But if I type command in SQL DB directly, everytime it will work.
Any Suggestion?  Also, in the same vi, there is error when close the DB connection.Message Edited by turbot on 06-25-2007 10:01 PM


shot.JPG:
http://forums.ni.com/attachments/ni/170/255204/1/shot.JPG


DB_Restore.vi:
http://forums.ni.com/attachments/ni/170/255204/2/DB_Restore.vi
From: tst on
The most likely reason is that your connection is broken somewhere and what you are getting is essentially a non-existent connection error (which is why you get an error when you try to close it). I'm guessing this will also happen with other SQL queries.
This could be, for example, because you disconnected the network cable, or because you have a bad network, or because the computer with the DBMS on it was rebooted, but assuming that your odd times and even times means number of times, then the most likely explanation is that you are closing the connection yourself and not opening it again for the "even times". The basic solution would be not to close the connection and to check the validity of the connection before using it and if it throws an error, close it and open a new connection to the DB.