I have the following code: ...query = "INSERT INTO a_test_table (a_test_table_id,name,last_mod_date,create_date) VALUES (?a_test_table_id,?name,?last_mod_date,?create_date)";
...
command.Prepare();
...
command.Parameters.Add("?a_test_table_id", MySqlDbType.Int32);
command.Parameters["?a_test_table_id"].Direction =
ParameterDirection.Output;
command.Parameters.Add("?name", this._name);
command.Parameters.Add("?last_mod_date", DateTime.Now);
command.Parameters.Add("?create_date", DateTime.Now);
command.ExecuteNonQuery();
this.ID =
System.Convert.ToInt32(command.Parameters["?a_test_table_id"].Value.ToString());
When I try to retrieve the return value for ?a_test_table_id, I get an error saying the Value property is NULL.
The column in the database is set to auto-increment. Shouldn't this parameter be populated automatically? Any ideas why this is happening?
-- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/suppressed
Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.