我正在使用这种方法向表中插入一行:
MySqlConnection connect = new MySqlConnection(connectionStringMySql);
MySqlCommand cmd = new MySqlCommand();
cmd.Connection = connect;
cmd.Connection.Open();
string commandLine = @"INSERT INTO Wanted (clientid,userid,startdate,enddate) VALUES" +
"(@clientid, @userid, @startdate, @enddate);";
cmd.CommandText = commandLine;
cmd.Parameters.AddWithValue("@clientid", userId);
cmd.Parameters.AddWithValue("@userid", "");
cmd.Parameters.AddWithValue("@startdate", start);
cmd.Parameters.AddWithValue("@enddate", end);
cmd.ExecuteNonQuery();
cmd.Connection.Close();
我还有一个具有自增
功能的id列。我想知道是否可以获取插入新行时创建的id。