0

How do you refresh a database connection within a VB application to SQL Server 2005 so that whenever data is changed in SQL, such changes are picked up by the application? For now the application only picks up the changes after it has been restarted, and that is not what I want.

nickf
  • 499,078
  • 194
  • 614
  • 709

5 Answers5

1

You don't need to "refresh" a database connection. If your application is only picking up changes after it restarts, then there is something wrong with your transaction handling.

John Saunders
  • 157,405
  • 24
  • 229
  • 388
1

You are probably not commiting your chanes to the database. either that or not running the query again.

Mostlyharmless
  • 2,275
  • 19
  • 28
0

It's probably not the connection that needs to be refreshed. You might have something in your code that is querying data once at app startup, and never queries the data again. Can you post your code and what you're trying to do?

Andy White
  • 81,400
  • 46
  • 171
  • 205
0

Do you mean you want the data in your program to be automatically updated as the data in sqlserver changes? I don't think you can do that.

user78369
  • 61
  • 1
  • 2
0

I would start by looking for the command setting the Isolation Level of the transactions

   e.g. "*SET TRANSACTION ISOLATION LEVEL ...*"

This is either set in the code or defaulting from the DB. Identify which isolation level the app is running at and whether this is appropriate.

Either Google the command or look in SQL Server Books Online for more details.

Karl
  • 3,178
  • 17
  • 27