How to pass MySQL null parameter to DbCommand in corporate library
I am trying to pass null for the first parameter in the code below, but MySQL is complaining that
Incorrect number of arguments for PROCEDURE myProc; expected 2, got 1
When I manually call the procedure with the first argument as null it works, but when it EmptyAsNullStartsWith(employeeNumberText.Text)
returns null it complains.
Database db = DatabaseFactory.CreateDatabase(
ConfigurationManager.AppSettings["dbType"]
);
DbCommand cmd = db.GetStoredProcCommand("staff_listforinquiry");
db.AddeParameter(
cmd,
"in_employeeNumber",
DbType.String,
EmptyAsNullStartsWith(employeeNumberText.Text)
);
db.AddeParameter(
cmd,
"in_name",
DbType.String,
EmptyAsNullContains(employeeNameText.Text)
);
0
source to share