can i set sql statement to variable ?????

sudani1969

Member
Joined
Sep 25, 2009
Messages
13
Programming Experience
Beginner
hello every one
could any one direct me to the correct place to do the following
i had the follwing code to retrieve data from 2 diffrent table using sql statment, i want to check the result when a user enter a user name i want the to check agains the dtabase to
see if that user had already loged in today
so i want to see if that result is = 0 or "" im not sure how(and that is why im writing inthis forum)
if it is true do not logg the user but if it is false logg in this user
could any one direct me to the correct code

here is the code:
' Dim cm As New MySqlCommand
' Dim dr1 As MySqlDataReader
' con.open()
' Dim sql As String
' sql = "SELECT login_details.`date`, users.username FROM login_details INNER JOIN " &
' " users ON login_details.`user` = users.id WHERE (users.username = '" & txtUser.Text & "' AND `date` = CURDATE())"
' cm.Connection = con
' cm.CommandText = sql
' dr1 = cm.ExecuteReader()

' If sql.ToString = "" Then
' do the following
Else
msgbox("you have already logged in")


PS: i'm using VS 2010 and i'm using vb
 
Back
Top