ExecuteNonQuery: Error Cannot open action query ''

  • Thread starter Thread starter fniles
  • Start date Start date
F

fniles

I am using VB.NET 2005 and MS Access.
I use OLEDbCommand ExecuteNonQuery to delete a record from a database.
Whenever the program gets a message, it creates a new thread to process that
message.
In the thread I open the database, then process the message.
Sometimes I get an error "Error Cannot open action query ''". Why can it
execute the query and how to fix it ?
Thank you.

Public Class Best
Dim clsEachMessage As New EachMessage

EachMessageThread = New Threading.Thread(AddressOf
clsEachMessage.ProcessMessage)
:

Public Class EachMessage
Dim adoConOLE As OleDb.OleDbConnection = Nothing
Private m_cmd As OleDb.OleDbCommand

Public Sub ProcessMessage()
adoConOLE = New OleDb.OleDbConnection
With adoConOLE
.ConnectionString = g_dbPath
.Open()
End With

m_cmd = New OleDb.OleDbCommand
With m_cmd
.Connection = adoConOLE
.CommandText = sSQL
End With
m_cmd.ExecuteNonQuery() --> Error Cannot open action query ''
 
Hi,

Do you have in the other thread altready a OleDB connection open?
Close that than first,

Cor
 
I open the connection in the beginning of each thread. And at the end of
each thread, I close the connection.
So you think the error "Error Cannot open action query ''" is because the
maximum connection has been reached ?

Thanks.
 
Back
Top