Just nu i M3-nätverket
Jump to content

No data exists for the row/column


Freddanson

Recommended Posts

Jag får detta meddelande trots att jag vet att det finns data i databasen. Kan felmeddelandet bero på ett annat fel jag gjort. Så här ser koden ut i proceduren:

 

Sub RedirectPage()

Dim sName As string

Dim sPassw As string

Dim sPage As String

Dim cn As OleDbConnection

cn = new OleDbConnection(ConfigurationSettings.Appsettings("DbConn"))

Dim dr as OleDbDataReader

Dim cmd As new OleDbCommand("SELECT page FROM login " & "WHERE name='" & sName & "' AND passw='" & sPassw & "'", cn)

cn.Open()

dr = Cmd.ExecuteReader(CommandBehavior.CloseConnection)

Response.Redirect(dr("Page"))

End Sub

 

//Fredrik

 

Link to comment
Share on other sites

Sub RedirectPage()
Dim sName As string
Dim sPassw As string
Dim sPage As String
Dim cn As OleDbConnection
cn = new OleDbConnection(ConfigurationSettings.Appsettings("DbConn"))
Dim dr as OleDbDataReader
Dim cmd As new OleDbCommand("SELECT page FROM login " & "WHERE name='" & sName & "' AND passw='" & sPassw & "'", cn)
cn.Open()
dr = Cmd.ExecuteReader(CommandBehavior.CloseConnection)
if dr.Read then
 Response.Redirect(dr("Page"))
else
 Response.Redirect("404.asp") 'Eller whatever
end if
End Sub

 

Link to comment
Share on other sites

Archived

This topic is now archived and is closed to further replies.



×
×
  • Create New...