M
Matt
In ASP 3.0, rs("field_name") is able to get the value of field_name in a
recordset.
In ASP.NET using VB.NET, I think SqlDataReader is the substitute of
recordset? I don't quit understand how to use it.
Here's my code attempts, but it yields run-time error "Invalid attempt to
read when no data is present"on dr(i).ToString
Dim cn As New SqlConnection(cs)
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()
For i = 0 To dr.FieldCount - 1
strLine = strLine & dr.GetName(i).ToString & Chr(9) & dr(i).ToString
Next
Please advise!
Thanks!
recordset.
In ASP.NET using VB.NET, I think SqlDataReader is the substitute of
recordset? I don't quit understand how to use it.
Here's my code attempts, but it yields run-time error "Invalid attempt to
read when no data is present"on dr(i).ToString
Dim cn As New SqlConnection(cs)
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()
For i = 0 To dr.FieldCount - 1
strLine = strLine & dr.GetName(i).ToString & Chr(9) & dr(i).ToString
Next
Please advise!
Thanks!