I am just carrying out a query, and have started using parameters. And all was going great, until a null string is passed. It worked fine before, using "name = " + Name Where name may or maynot be null.
Is there as simple way around this?
Also on the topic, I havent tried it yet, but can I identify parameters by anything other than numbers. It is a potential area to go wrong, having 14 number parameters with no identification to which is which, except hoping they are in the correct order. (What if i come to add another in)
Error message : The parameterized query '(@0 nvarchar(5),@1 nvarchar(4),@2 nvarchar(4000),@3 nvarchar(400' expects the parameter '@2', which was not supplied.
The Parameterised query:
db.Execute("Update User SET Name = @0 , Address1 = @1 , Address2 = @2 , Address3 = @3, Address4 = @4 , Postcode = @5 , Title = @6, " +
" Surname = @7 , Forename = @8 , Tel = @9, Fax = @10 , Mobile = @11 , Email = @12 WHERE UserNo = @13",
Name, Address1, Address2, Address3, Address4, Postcode, Title, Surname, Forename, Tel, Fax, Mobile, Email, UserNo);