Results 1 to 2 of 2

Thread: SP parameters

  1. #1

    Thread Starter
    Fanatic Member
    Join Date
    Dec 2002
    Location
    London
    Posts
    678

    SP parameters

    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

  2. #2
    Registered User
    Join Date
    Mar 2002
    Location
    Nashville, TN
    Posts
    103
    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!

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width