Hi,
What is the difference between
command.parameters.add("@Email",txtEmail.text)
and
command.parameters.add("@Email",sqldb.char,10)
command.parameters("@Email").value=txtEmail.text
Printable View
Hi,
What is the difference between
command.parameters.add("@Email",txtEmail.text)
and
command.parameters.add("@Email",sqldb.char,10)
command.parameters("@Email").value=txtEmail.text
Not much actually. I personally prefer the second method because it forces the declaration of the parameter type in code (thus if you pass a value of the wrong type VB will raise the error instead of SQL...the error message is usually a little more intuitive in VB than in SQL since SQL error handling leaves a lot to be desired). Not only that but the second method is good coding practice. When other developers are looking through your code, they can see right away what the parameter datatype is instead of having to pull up the SP in SQL to make sure the value being passed is correct. Hope that helps!