Link to home
Start Free TrialLog in
Avatar of ur_cherub
ur_cherub

asked on

Problem with OleDb.OleDbCommand.ExecuteScalar

Hi Experts,

I'm having a problem with the following piece of code.. Don't kno the reason for it and how to go bout correcting it...

---------------------------------

Dim Cmd1 As OleDb.OleDbCommand = New OleDb.OleDbCommand("SELECT UserName FROM Login WHERE UserName=" & txtUser.Text, Conn)

Dim userid As String = New String(CStr(Cmd1.ExecuteScalar))

---------------------------------

('txtUser' is a text box and 'conn' is an OleDbConnection). The error i'm getting is
      "No value given for one or more required parameters." for the second Dim statement...

pls help me out...
thank u...
ASKER CERTIFIED SOLUTION
Avatar of Éric Moreau
Éric Moreau
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of ur_cherub
ur_cherub

ASKER

Thank u very much emoreau...
very stupid of me to have left that out...

thanks a lot