Je suis en train de passer une valeur nulle pour le premier paramètre dans le code ci-dessous, mais MySQL se plaint queComment passer le paramètre MySQL null sur DbCommand Enterprise Library
Incorrect number of arguments for PROCEDURE myProc; expected 2, got 1
Quand j'appelle manuellement la procédure avec le premier argument est nul, cela fonctionne, mais quand EmptyAsNullStartsWith(employeeNumberText.Text)
renvoie null, il se plaint.
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)
);
Cela fonctionne maintenant, avec juste un null standard. Je soupçonne que quelque chose était caché quelque part. – ProfK