473,791 Members | 2,725 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.BeginTrans action();
Cmd.Transaction = trans;
try
{
Cmd.ExecuteNonQ uery();
trans.Commit();
return true;
}
Catch(Exception ex)
{
trans.Rollback( );
MessageBox.Show (ex.Message.ToS tring());
}

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!
Nov 16 '05 #1
0 1930

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
1461
by: Sims | last post by:
Hi, I have a function to update some data, I run a set of 6 queries, ( all updates and all on the same table). I seem to run into problems where the data does not seem to be updated properly or the update appears to be wrong. What the function is doing, (try to do anyway), is given some ID numbers A, B and the same table
6
1803
by: Mosher | last post by:
Hi all, I am wanting to automatically do dump of a mysql database nightly using cron and some kind of script that will email the whole db structure to me (as an attachment or as plain text in my email) - including the data in the db. So, if the db was ever lost, I could go to my email, find the dump and copy and paste it into the mysql db again. Does anyone know how to do this in PHP or of a premade (and free) script out there,...
0
2056
by: Richard Gabriel | last post by:
Hi all, The following keeps happening and I can't pinpoint a query that is causing it. It did not happen in 3.23.x, but started upon upgrading to 4.0.14. The operating system/hardware information is as follows: RedHat 8.0 - kernel 2.4.18SMP 4x Xeon Processors 4x 80GB SCSI drives (hardware RAID-10) 2GB RAM
2
6562
by: Paul Reddin | last post by:
Hi, (V8.1 Fp2) Our application uses JDBC batch to execute mutiple insert statements and we saw a strange thing this morning. There were 4 SQL Insert statements in the batch, and we know the 2nd would have violated a Unique Constraint and failed, but the SQL error returned was related to the 3rd statement (which had a FK dependent on the 2nd
6
11238
by: Charles Neitzel | last post by:
I'm trying to write a windows application in C# (Using Microsoft Visual C# 2005 Express) that is nothing more than a simple UI with buttons on it. The buttons do various things like running programs and executing registry entries. The majority of my buttons work however, I have come upon a problem. I need a few of the buttons to run DOS batch files, the batch files in turn run program installers (specifically windows update runtime .exe...
1
2078
by: Karuna | last post by:
Hi, I am new to MySQL. I want to create a script file which will include a number of commands and execute it, just like we do in Oracle. Can any one tell me how to do it? Suppose I want to create a script called "temp" that will contain say 4 create statement. I want someone to show me how to create that file and execute it. And how to capture the output in a separate file like we do in Oracle. And what should be the extension of the...
2
2161
by: bwana.mpoa | last post by:
Hi, We're using a mySQL database as a replica of another (Sybase) DB for reporting purposes. The Sybase is part of a real-time mission critical system - hence the separate database where people can run their queries on. Currently a separate application is copying the information we're interested in from Sybase to mySQL in an overnight batch-process. We want to extend this to loading every 15 minutes and are now investigating the...
2
2695
by: Ted | last post by:
1) In several tables, in my MySQL version, I created columns using something like the following: `ab_timestamp` timestamp NOT NULL default CURRENT_TIMESTAMP on update CURRENT_TIMESTAMP, This allowed me to ensure that when a record is either added or edited, the value in the field is set to the current date and time. I.E., ab_timestamp is given the current date and time when a record is created, and then it is updated to the date and...
13
4728
by: S.Dickson | last post by:
I had an access database that i use as an ordering system. I have a form for entering customer details. When i add a new customer on the form the customer number is an auto number that appears when i type in the details. I have just moved over to mysql server with access as the front end. I have setup the sql tables with the customer number as autonumber. When i go into the form and add a new customer it does not generate the
0
9669
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
9515
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
1
10154
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9993
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
1
7537
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
6776
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5430
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4109
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3713
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.