SQL query Lookup for Newbie

N

Newbie!

Hi Group,

Im writting a small Username/Password verification into my Database.

I have a cboBox which is Populated from my dataset which has "SELECT
[Password], UserName, SystemUsersID FROM SystemUsers" in it.

In My Login Button I have:

Dim Password As String
******
If txtPassword.Text=Password Then
Success
Else
Failed
End If

My Database is a Access Database. I know i Need to put "Password=????? SQL
QUERY ?????" where the ******'s are but I don`t know exatly what.

Could anybody please point me in the right Direct?

I know it must be something like "Password = SELECT [Password], UserName,
FROM SystemUsers".

I`ve search all over but just carn`t find any examples

Thanks in Advance

Ta
Si
 
J

Jim Mirra

I think you are looking for:

dim auth as boolean = false
dim strSQL = "Select * from systemusers where password = '& txtPassword.Text
& "'"
Dim connect as new SqlConnection([place connection string here])
Dim objCmd as new sqlcommand(strSQL, connect)
Dim objDR as SqlDataReader
objDR = objCmd.ExecuteReader()

while objDR.Read()
auth = true
End While

if auth then
Success
else
Failed
end if
------
I use SQL this may have to be modded for oledb instead of SqlClient when
using accesss

HTH,

Jim Mirra
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Similar Threads


Top