VB 6 to Sql 2k5 connection problem

  • I have to baby sit a vb 6 data engine until we have time this fall to start the C# conversion. [Insert groan here].

    I'm experiencing a weird problem. When I run the app in the vb ide for the first time it works ok. But after stopping and restarting it will no longer connect.

    When this happens I do not see a connection in enterprise manager. I don't see any connection being created in ent. mgr. And the error I get back from the connection is '[Microsoft][ODBC SQL Server Driver][DBNETLIB]SQL Server does not exist or access denied.

    If I shut down my ide and restart it from scratch it will again connect properly the first time, then do the same thing again.

    The code base I inherited is not very good. It connects to multiple databases and when I first inherited it I notice that it never closed any connections. I was able to clean some of that up but this behavior still happens.

    This does not happen when run as an exe.

    Has anybody observed this sort of thing ? Any suggestions would be appreciated and thanks.

    Bill, Charlotte nc

  • Check your code may be in test mode it is closing connection to the database after certain point. In VB once the connection is open it will remain open until you explicitly close.

    SKC

  • Sounds like a possible scenario is this:

    The app just used to open connections and leave them open for multiple screens/processes or whatever. You have now corrected this by closing them connections between database operations, but the app is still making assumptions that the connection is open.

    Quite often VB6 apps I have come across use a global variable to represent a SQL connection, which is closed and set to nothing after a database operation. If you try and use the connection without setting it to a new ADODB.Connection and opening that connection that could cause the issue.

  • Debug the code - and the problem should be evident.

Viewing 4 posts - 1 through 3 (of 3 total)

You must be logged in to reply to this topic. Login to reply