using ySQL 4.1.9 and mysql-connector-net-1.0.4.
the following occurred.

CREATE TABLE customer (
 code INT NOT NULL DEFAULT 0 PRIMARY KEY,
 name VARCHAR(64) NOT NULL DEFAULT ''
);
INSERT INTO customer VALUES
(1, 'aaaa'), (2, 'bbbb'), (3, 'cccc');


MySqlConnection con = new MySqlConnection(
    "Server=localhost; Database=test;");
con.Open();

MySqlCommand cmd = con.CreateCommand();
cmd.CommandText = "SELECT * FROM customer;";

MySqlCommand cmd2 = con.CreateCommand();
cmd2.CommandText = "UPDATE customer SET name=?name WHERE code=?code;";

using (MySqlDataReader dr=cmd.ExecuteReader()) {
    for (int i=0; dr.Read(); i++) {
        cmd2.Parameters.Clear();
        cmd2.Parameters.Add("code", MySqlDbType.Int32).Value = dr[0];
        cmd2.Parameters.Add("name", MySqlDbType.String).Value =
            (i + 1).ToString();
        cmd2.ExecuteNonQuery();
    }
}

External Program Failed: Test.exe (return code was -532459699)

but cmd2 use new connection, no occurred.

Thanks in advance.

__________________________________
Let's Celebrate Together!
Yahoo! JAPAN
http://pr.mail.yahoo.co.jp/so2005/


-- 
MySQL General Mailing List
For list archives: http://lists.mysql.com/mysql
To unsubscribe:    http://lists.mysql.com/[EMAIL PROTECTED]

Reply via email to