hello,
as can be seen below, i'm trying to get the value of a field from my database and assign it to a session variable, but i just get this error:
"System.InvalidOperationException: No data exists for the row/column."
i'm new to asp.net so apologise if this is a fairly weak problem but it's been getting at me all day! if anyone could help out that would be grand...
my code at the moment:
Dim conn As OleDbConnection
Dim cmd As OleDbCommand
Dim result As String
Dim dbread As OleDbDataReader
conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("project.mdb")
Dim strSQL2 As String = "select * from tblBasicUser where Username = '" & txtUsername.Text & "' and Password = '" & txtPassword.Text & "'"
conn.Open()
cmd = New OleDbCommand(strSQL2, conn)
dbread = cmd.ExecuteReader()
Session("userid" = dbread.Item(1)
cheers,
matt
as can be seen below, i'm trying to get the value of a field from my database and assign it to a session variable, but i just get this error:
"System.InvalidOperationException: No data exists for the row/column."
i'm new to asp.net so apologise if this is a fairly weak problem but it's been getting at me all day! if anyone could help out that would be grand...
my code at the moment:
Dim conn As OleDbConnection
Dim cmd As OleDbCommand
Dim result As String
Dim dbread As OleDbDataReader
conn = New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("project.mdb")
Dim strSQL2 As String = "select * from tblBasicUser where Username = '" & txtUsername.Text & "' and Password = '" & txtPassword.Text & "'"
conn.Open()
cmd = New OleDbCommand(strSQL2, conn)
dbread = cmd.ExecuteReader()
Session("userid" = dbread.Item(1)
cheers,
matt