我正在使用此方法在表中插入一行:
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();