Hello, I'm trying to retreive info from a query in order to add it to a query but in the process it displays this error:
No data exists for the row/column.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: No data exists for the row/column.
Source Error:
Line 22: Dim StrReader As OleDbDataReader
Line 23: StrReader = objCmd.ExecuteReader()
Line 24: Response.Write("the value is " + StrReader.Item("clave"))
Line 25: Response.End()
Line 26: 'Dim myCookie As HttpCookie = New HttpCookie("UserSettings")
This is the full code:
How can i solve this?
Thx.
No data exists for the row/column.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.InvalidOperationException: No data exists for the row/column.
Source Error:
Line 22: Dim StrReader As OleDbDataReader
Line 23: StrReader = objCmd.ExecuteReader()
Line 24: Response.Write("the value is " + StrReader.Item("clave"))
Line 25: Response.End()
Line 26: 'Dim myCookie As HttpCookie = New HttpCookie("UserSettings")
This is the full code:
Code:
<script runat="server">
Sub Page_Load(ByVal obj As Object, ByVal e As EventArgs)
If IsPostBack() Then
Dim objConn As New OleDbConnection("Provider=SQLNCLI;Server=db2fx981\comware;Database=SIP;Trusted_Connection=yes;")
objConn.Open()
Dim sSQL, Resul As String
sSQL = "select * from usuario where usuario='" & Request("pwdusr") & "' and clave='" & Request("pwdpwd") & "'"
'Response.Write(sSQL)
'Response.End()
'"Insert into Origen (Descripcion) values ('" & Descripcion.Text & "')"
Dim objCmd As New OleDbCommand(sSQL, objConn)
Resul = objCmd.ExecuteNonQuery
If Resul Then
Dim StrReader As OleDbDataReader
StrReader = objCmd.ExecuteReader()
Response.Write("el valor es " + StrReader.Item("clave"))
Response.End()
'Dim myCookie As HttpCookie = New HttpCookie("UserSettings")
'myCookie("Font") = "Arial"
'myCookie("Color") = "Blue"
'myCookie.Expires = Now.AddDays(1)
'Response.Cookies.Add(myCookie)
'Response.Redirect("[URL unfurl="true"]http://www.google.com")[/URL]
'LblSaved.Visible = True
Else
Lblwrong.Visible = True
End If
End If
End Sub
</script>
How can i solve this?
Thx.