ExecuteNonQuery: Error Cannot open action query ''

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 ''
 
C

Cor Ligthert[MVP]

Hi,

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

Cor
 
F

fniles

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.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top