Hi,
I use VS 2003 and your latest version of MyDirect.NET
I would like update my DB table (tbl_xy) with following commands:
[code]string sSQL = "SELECT * FROM tbl_xy";
MySqlCommand cmd = new MySqlCommand(sSQL, cn);
MySqlDataTable dt = new MySqlDataTable();
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
da.Fill(dt);
DataRow dr = dt.Rows[0];
dr["a"]= "b";
MySqlCommandBuilder cb = new MySqlCommandBuilder(da);
da.Update(dt);[/code]
The last line generate the following MySqlException:
"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 'cnString.tbl_xy SET a= 'b' WHERE ID = '1' at line 1"
where is the problem?
For example select, update, delete ... with ExecuteReader does work fine.[/code]
Update db via MySqlCommandBuilder
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
-
- Posts: 2
- Joined: Wed 20 Feb 2008 11:11
-
- Posts: 729
- Joined: Thu 13 Dec 2007 10:24
You may use this code:
Code: Select all
mySqlCommandBuilder1.Quoted = true;