If this is your first visit, be sure to check out the FAQ by clicking the link above. You may have to register before you can post: click the register link above to proceed. To start viewing messages, select the forum that you want to visit from the selection below.

 
Go Back  dBforums > Database Server Software > MySQL > mysql batch update with c#

Reply
 
LinkBack Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old 07-15-04, 23:16
jayson_13 jayson_13 is offline
Registered User
 
Join Date: Mar 2003
Posts: 4
mysql batch update with c#

Hi,

I would like to execute a batch update (mysql) with C#. How do I do
that?

For example,


OdbcCommand cmd = New OdbcCommand();
Cmd.Connection = Conn;
cmd.CommandText = "UPDATE stockin SET Out = 0 WHERE ID = 11;"
cmd.CommandText += "UPDATE stockout SET Returned = 1 WHERE ID =
53;"
OdbcTransaction trans = Conn.BeginTransaction();
Cmd.Transaction = trans;
try
{
Cmd.ExecuteNonQuery();
trans.Commit();
return true;
}
Catch(Exception ex)
{
trans.Rollback();
MessageBox.Show(ex.Message.ToString());
}

I get this error :

ERROR [42000] [MySQL][ODBC 3.51 Driver][mysqld-4.0.17-nt]You have
an error in your SQL syntax. Check the manual that corresponds to
your MySQL server version for the right syntax to use near '; UPDATE
stockout SET Returned = 1, ReturnedOn = NOW(), Returne

I have tried using MySQL administrative tools (MySQL Front) to
test batch transactions and it doesn't give me any error.


Please help me. Thank you!
Reply With Quote
Reply

Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On