Cannot LOCK TABLE tablename WRITE through ADODB.command using MySQL
am 10.01.2005 07:03:32 von Tim Mot
--0-700275490-1105337012=:25462
Content-Type: text/plain; charset=us-ascii
Hello eveyrbody
As written in the question title I have problems with Visual Basic and MySQL.
I use Visual Basic .Net but I actually imported the ADO objects from Visual Basic 6.0.
I tried to "LOCK TABLE mytable WRITE" and I get this error "Command text was not set for the command object." {String}.
I tried the query on the MySQL Control Center and it works fine.
It seems like MyODBC does not recognize this command. I cannot undertand why.
Is there anybody that can help me with this? It is really annyoying!
Here is the code:
Private Function lockBookTable() As Boolean
Dim connection As New ADODB.Connection
Dim command As New ADODB.Command
Dim sql As String
sql = "LOCK TABLES library.book WRITE"
If Not Me.bookLocked Then
Try
connection.Open("library", "root", "ri3lim")
command.ActiveConnection = connection
command.Execute(sql)
Me.bookLocked = True
connection.Close()
Return True
Catch ex As Exception
Me.bookLocked = False
mainForm.setMessage(ex.Message)
Return False
End Try
End If
End Function
---------------------------------
Do you Yahoo!?
Yahoo! Mail - Easier than ever with enhanced search. Learn more.
--0-700275490-1105337012=:25462--
Re: Cannot LOCK TABLE tablename WRITE through ADODB.command using MySQL
am 11.01.2005 14:11:18 von Daniel da Veiga
Correct me if I'm wrong, but when you use the "command" object type,
you must SET the command text, not pass it as an argument for the
"execute" method (But I'm not sure).
Hope that helps,
On Sun, 9 Jan 2005 22:03:32 -0800 (PST), Tim Mot wrote:
> Hello eveyrbody
> As written in the question title I have problems with Visual Basic and MySQL.
> I use Visual Basic .Net but I actually imported the ADO objects from Visual Basic 6.0.
> I tried to "LOCK TABLE mytable WRITE" and I get this error "Command text was not set for the command object." {String}.
> I tried the query on the MySQL Control Center and it works fine.
> It seems like MyODBC does not recognize this command. I cannot undertand why.
> Is there anybody that can help me with this? It is really annyoying!
>
> Here is the code:
>
> Private Function lockBookTable() As Boolean
>
> Dim connection As New ADODB.Connection
>
> Dim command As New ADODB.Command
>
> Dim sql As String
>
> sql = "LOCK TABLES library.book WRITE"
>
> If Not Me.bookLocked Then
>
> Try
>
> connection.Open("library", "root", "ri3lim")
>
> command.ActiveConnection = connection
>
> command.Execute(sql)
>
> Me.bookLocked = True
>
> connection.Close()
>
> Return True
>
> Catch ex As Exception
>
> Me.bookLocked = False
>
> mainForm.setMessage(ex.Message)
>
> Return False
>
> End Try
>
> End If
>
> End Function
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail - Easier than ever with enhanced search. Learn more.
>
--
Daniel da Veiga
Computer Operator - RS - Brazil
--
MySQL Windows Mailing List
For list archives: http://lists.mysql.com/win32
To unsubscribe: http://lists.mysql.com/win32?unsub=gcdmw-win32@m.gmane.org
Re: Cannot LOCK TABLE tablename WRITE through ADODB.command using MySQL
am 11.01.2005 15:12:53 von SGreen
--=_alternative 004E513785256F86_=
Content-Type: text/plain; charset="US-ASCII"
Tim Mot wrote on 01/10/2005 01:03:32 AM:
> Hello eveyrbody
> As written in the question title I have problems with Visual Basic and
MySQL.
> I use Visual Basic .Net but I actually imported the ADO objects from
> Visual Basic 6.0.
> I tried to "LOCK TABLE mytable WRITE" and I get this error "Command
> text was not set for the command object." {String}.
> I tried the query on the MySQL Control Center and it works fine.
> It seems like MyODBC does not recognize this command. I cannot undertand
why.
> Is there anybody that can help me with this? It is really annyoying!
>
> Here is the code:
>
> Private Function lockBookTable() As Boolean
>
> Dim connection As New ADODB.Connection
>
> Dim command As New ADODB.Command
>
> Dim sql As String
>
> sql = "LOCK TABLES library.book WRITE"
>
> If Not Me.bookLocked Then
>
> Try
>
> connection.Open("library", "root", "ri3lim")
>
> command.ActiveConnection = connection
>
> command.Execute(sql)
>
> Me.bookLocked = True
>
> connection.Close()
>
> Return True
>
> Catch ex As Exception
>
> Me.bookLocked = False
>
> mainForm.setMessage(ex.Message)
>
> Return False
>
> End Try
>
> End If
>
> End Function
>
>
>
>
> ---------------------------------
> Do you Yahoo!?
> Yahoo! Mail - Easier than ever with enhanced search. Learn more.
Does it work if you use the .Execute method of the Connection object (not
Command)? You are still in the same connection so you should still be in
the same context (to the database). If it is a problem with the Command
object + ODBC then this may be a workaround until it's fixed.
Shawn Green
Database Administrator
Unimin Corporation - Spruce Pine
--=_alternative 004E513785256F86_=--