I use the MySQL 6.9.11.0 mysql.data dll,and the MySql Server 5.7.29
MySqlCommand cmd = new MySqlCommand();
using (MySqlConnection conn = new MySqlConnection(connectionString))
{
PrepareCommand(conn, null, cmd, cmdType, cmdText, cmdParms);
MySqlDataAdapter da = new MySqlDataAdapter(cmd);
DataSet ds = new DataSet();
da.Fill(ds);
conn.Close();
cmd.Parameters.Clear();
return ds;
}
private static void PrepareCommand(MySqlConnection conn, MySqlTransaction trans, MySqlCommand cmd, CommandType cmdType, string cmdText, MySqlParameter[] cmdParms)
{
if (conn.State != ConnectionState.Open)
conn.Open();
cmd.Connection = conn;
cmd.CommandText = cmdText;
if (trans != null)
cmd.Transaction = trans;
cmd.CommandType = cmdType;
if (cmdParms != null)
{
foreach (MySqlParameter parm in cmdParms)
cmd.Parameters.Add(parm);
}
}
and i got this error.
Framework Version: v4.0.30319
Description: The process was terminated due to an unhandled exception.
Exception Info: System.NullReferenceException
at MySql.Data.MySqlClient.NativeDriver.GetResult(Int32 ByRef, Int64 ByRef)
at MySql.Data.MySqlClient.Driver.NextResult(Int32, Boolean)
at MySql.Data.MySqlClient.MySqlDataReader.NextResult()
at MySql.Data.MySqlClient.MySqlDataReader.Close()
at MySql.Data.MySqlClient.MySqlDataReader.Dispose(Boolean)
at MySql.Data.MySqlClient.MySqlDataReader.Finalize()
Is there something wrong with this mysql.data dll? thanks in advance!