M
Matt
I just want to get the value of field UserName and Password in SqlDataReader
object dr. But it yeields run-time error "Invalid attempt to read when no
data is present" on line dr("UserName") and dr("Password")
any ideas??
Dim sql As String = "select * from [Admin] where UserName = '" &
TextBox1.Text & "'" _
& "AND Password = '" & TextBox2.Text & "'" & ";"
Dim cmd As New SqlCommand(sql, cn)
cmd.Connection.Open()
Dim dr As SqlDataReader
dr = cmd.ExecuteReader()
Response.Write("User Name = " & dr("UserName"))
Response.Write("Password = " & dr("Password"))
object dr. But it yeields run-time error "Invalid attempt to read when no
data is present" on line dr("UserName") and dr("Password")
any ideas??
Dim sql As String = "select * from [Admin] where UserName = '" &
TextBox1.Text & "'" _
& "AND Password = '" & TextBox2.Text & "'" & ";"
Dim cmd As New SqlCommand(sql, cn)
cmd.Connection.Open()
Dim dr As SqlDataReader
dr = cmd.ExecuteReader()
Response.Write("User Name = " & dr("UserName"))
Response.Write("Password = " & dr("Password"))