• We’re currently investigating an issue related to the forum theme and styling that is impacting page layout and visual formatting. The problem has been identified, and we are actively working on a resolution. There is no impact to user data or functionality, this is strictly a front-end display issue. We’ll post an update once the fix has been deployed. Thanks for your patience while we get this sorted.

Pinging a database

phantom404

Golden Member
Is there a way to "Ping" a database to constantly check it to see if there are any records in it and write a program to display the number of records it finds? I could write the program if i knew of a way to "Ping" the database.
 
As Nothinman says, you're just talking about connecting to the database and issuing a query. Post the details of the database engine and application environment and I'm sure you'll get plenty of ideas.
 
Right now im connected to the Access Database through VB.net. I can run an sql statement but I cant figure out how to continuously run the sql statement over and over...kind of like monitoring it
 
Are you using VB.Net inside of Access or in a separate application? If it's a separate application you should be able to just use a loop to run your query indefinitely or until some condition is met.
 
Couldn't you setup a timer to query every so many seconds (should only take a millisecond to query the DB though) and if it fails the query stop the timer...
 
K i have the program set up up and going refreshing every 10 seconds but for some reason at random times it crashes and here is the error:


************** Exception Text **************

System.Data.OleDb.OleDbException: Unspecified error

at System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection)

at System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject)

at System.Data.ProviderBase.DbConnectionFactory.CreateNonPooledConnection(DbConnection owningConnection, DbConnectionPoolGroup poolGroup)

at System.Data.ProviderBase.DbConnectionFactory.GetConnection(DbConnection owningConnection)

at System.Data.ProviderBase.DbConnectionClosed.OpenConnection(DbConnection outerConnection, DbConnectionFactory connectionFactory)

at System.Data.OleDb.OleDbConnection.Open()

at WrMon.Form1.timer1_Tick(Object sender, EventArgs e)

at System.Windows.Forms.Timer.OnTick(EventArgs e)

at System.Windows.Forms.Timer.TimerNativeWindow.WndProc(Message& m)

at System.Windows.Forms.NativeWindow.Callback(IntPtr hWnd, Int32 msg, IntPtr wparam, IntPtr lparam)

Any clue as to what it could be? Dio i have it hitting the db to quickly?
 
Looks like you have some debuggin to do, hard to say what the problem is though since the exception is just "Unspecified Error".
 
Are you closing the connection each time or just opening a new one and never releasing? Are you trying to open an already open connection?
 
I was opening a connection each run. At the end of each run, its also closing. I think i pretty much got everything working but now I noticed it errors out when someone else is accessing the database because it locks out anybody else from viewing....is there a way to get around this or checking to see if the database is locked and tell it to pause for a couple seconds.

Thanks for replies all
 
Back
Top