how to retrieve multiple usernames from a tab

Microsoft Windows xp professional w/serv...
July 30, 2010 at 08:04:12
Specs: Windows XP
These is is the code i wrote to try and retrieve multiple usernames in the same table.

If txtUserName.Text = "" Or txtPassword.Text = "" Then
MsgBox("please provide full information")


End If

conn = New SqlConnection("Data Source=.\SQLEXPRESS;AttachDbFilename=C:\Documents and Settings\General\My Documents\Visual Studio 2008\Projects\Example\Example\Database1.mdf;Integrated Security=True;User Instance=True")
cmd = New SqlCommand("select username from login where username ='" & txtUserName.Text & "'", conn)
conn.Open()
dtr = cmd.ExecuteReader()


If dtr.Read = False Then
MsgBox("try again")

Else
dtr.Close()
cmd = New SqlCommand("select password from login where password ='" & txtPassword.Text & "'and username ='" & txtUserName.Text & "'", conn)

dtr = cmd.ExecuteReader()
If dtr.Read = True Then
MsgBox("congratulations")
Else
'MsgBox("password wrong")
End If
End If
dtr.Close()
conn.Close()


See More: how to retrieve multiple usernames from a tab

Report •

#1
July 30, 2010 at 13:11:17
belongs in the programming forum
moderator please move. Thx

Report •
Related Solutions


Ask Question