3146 runtime error. ODBC call failed

greenspun.com : LUSENET : SQL Server Database Administration : One Thread

We receive this error 'sporadically' on VB applications using VB3 or VB4 (16bit) accessing SQL Server 6.5 and usually when an Access 2.0 database is also being used. (Usually a SQL Server table is linked to Access.) The error may occur and after trying 3 or 4 times, the application may run. Not everyone who runs the application gets this error. I have been unable to get helpful information from MSDN or any of the online help sources. Since it appears this error may be related to SQL Server, I thought maybe someone accessing this website may be able to help. Any ideas how I can track down the problem? Thanks.

-- Anonymous, December 30, 1998



Sorry for the delay in getting back. I was on vacation.

I found this interchange on DejaNews:

There is one big change from VB3 to VB4 (or in the corresponding Jet versions). The calls to open a recordset/snapshot used to retrieve all the records from the server immediately. This could take a long time, so they changed it so that it did not retrieve all the records immediately (i.e. they gave control to the programmer as to when the records are retrieved). However, until you do retrieve all the records, or close the recordset, you can't issue another query on the same connection.

Some solutions are: issue a movelast to retrieve all the records for the first query; open a new connection for the second query; and close the first recordset.

I had to do a port from VB3 to VB4, and I'd recommend you change all the calls to CreateSnapshot to OpenRecordset, particularly if you intend to use VB432. There is online help on the topic.

Regards, Roger Beardsworth.

David LaPorte wrote in article <33F8C9DF.42D4@pcisys.net>... > Here it is: > > Using a WIN_3.1 application developed in VB3 for SQL Server 4.1 (worked > fine)NOW running on Win95 (server runs on NT). > > Now upgrading to VB416 and SQL Server 6.5.... > Here's the problem..this app was designed using the OpenDatabase method > to connect to the ODBC SQL Server driver. It uses CreateSnapshot (as a > DB_SQLPassthrough) to generate data. THE FIRST QUERY WORKS FINE but > when we try to run the next one using the same method it fails with ODBC > error 3146. We are using the latest ODBC drivers from Microsoft > > Eeventually we will use a different method to access the DB (DBLib or > RDO). Seems like the dataset gets hung or something..were there MAJOR > chnages in the versions that would cause this? (ie. unsupported > syntax). Is it the ODBC Driver or Jet Engine?..HELP!!!!!!!!! > > Thanks > > David LaPorte

-- Anonymous, January 06, 1999

Moderation questions? read the FAQ