Skip to content
Advertisement

The parameterized query expects the parameter which was not supplied

I’m having a problem with my code:

Once I typed in the string in the textbox to search for an item I get this error:

The parameterized query ‘(@Parameter1 nvarchar(4000))SELECT * FROM borrow where (Departme’ expects the parameter ‘@Parameter1’, which was not supplied.

Can anyone help me?

Advertisement

Answer

If you pass null value to parameter,you will get this error even after you add the parameter so try to check the value and if it null then use DBNull.Value

This will work

This will convert the null values from the object layer to DBNull values that are acceptable to the database.

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement