mysql连接器 不支持将null参数传递给连接,所以在加入以前必须得判断是否为null,类似sqlhelper应该修改一下:
Code
private static void PrepareCommand(MySqlCommand cmd, MySqlConnection conn, MySqlTransaction trans, 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)
{
if (parm != null)
cmd.Parameters.Add(parm);
}
}
}