what is wrong with these statements

  • declare

    @varUser_Name as nvarchar(30),

    @varPassword as nvarchar(50)

    set @varUser_Name = 'Brain Pregler'

    set @varPassword = 'beer'

    select operator_ID from operator

    where username = @varUser_Name and password = @varPassword

    I am trying to test this query for a vb.net app. if I hard code the username and password the qwery works. what am I missing

  • I am using query analizer to test this code

  • I am using query analizer to test this code

  • What error are you getting?

    In your example, is the @varUser_Name a typo?

    You have BRAIN, shouldn't it be BRIAN?

    -SQLBill

  • oh dear god. it is time to go to sleep. sorry about wasting your time. thanks SQLBill

  • You have to add an N to the front of the variable.

    set @varUser_Name = N'Brain Pregler'

    set @varPassword = N'beer'

    This is from books online:

    "Unicode constants are specified with a leading N: N'A Unicode string'"

    Tom

  • It wasn't a waste of time....sometimes the little things are just overlooked. I know I've had it happen to me.

    -SQLBill

    When is the obvious not obvious? When someone else has to point it out to me!

Viewing 7 posts - 1 through 7 (of 7 total)

You must be logged in to reply to this topic. Login to reply