IrishNewbie wrote:
Am i heading in the right direction at all with that much?
|
theres a better way, and there's all sorts of holes in your code
1) First off.. with your SQL statement.. how are you supposed to know what Password to get if the person isn't logged in to provide your code with what "StudentID" we are using
2) What about checking the username??
3) How are you planning on having the code "remember" that the person entered the right password?
I mean see, those three questions have absolutely zip to do with exact coding, this whole project of your hasn't been thought out on single bit judging by what you have posted.... you are so unprepared..... maybe you take that constructive criticism as "me being a prick", but as long as you realize that you really need to do some research and learn some basics before taking on something so incredibly far over your head...... it appears you just copied and pasted some code w/o having even the slighest clue on what it does or is used for.... that's never ever going to result in success
anyways.. alternative code following along with this excellent data access article from 4guysfromrolla
Dim myConnection As OleDbConnection
Dim myCommand As OleDbCommand
Dim myDataReader As OleDbDataReader
Dim aQuery As String
aQuery = "SELECT StudentID, Uname FROM Students WHERE Pword = '" & Replace(strPassword,"'","''") & "' AND Uname = '" & Replace(strUsername,"'","''") & "'"
myConnection = New OleDbConnection(aConnection)
myConnection.Open()
myCommand = New OleDbCommand(aQuery, myConnection )
myDataReader = myCommand.ExecuteReader()
If myDataReader.HasRows() then
'Login Good, we have rows returned that matched
While myDataReader.Read()
'maybe store the Uname and StudentID in session variables or something
End While
else
'Login Bad since we have no rows
End if
myDataReader.Close()
myConnection.Close
you can take my criticism/help or leave it, i am not here to make friends or do anyone else's work for them, i'm here to help with code :) but what you are after right now is not code, its getting a clue on what the heck you are doing from a much higher level