ciao,
è la prima ovlta che utilizzo i codebehind, sto provando del codice che funzionava perfettamente prima.
nella mia pagina.aspx includo il codice cosi:
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="login.aspx.vb" Inherits="laspiaggetta.ViewStateInSessionVar"%>
nel file login.aspx.vb ho questo:
codice:
Imports System.Data.OleDb
Imports System.Data
Public Class ViewStateInSessionVar
Inherits System.Web.UI.Page
Protected WithEvents Label1, Label2, Errore As System.Web.UI.WebControls.Label
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents Nome, Pwd As System.Web.UI.WebControls.TextBox
Sub Login(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim ObjDatabase As New laspiaggetta.TYASPNET.database()
ObjDatabase.ConnectionString = "provider=Microsoft.Jet.OLEDB.4.0; data source=" & Server.MapPath("../mdb-database/spaiggetta-db.mdb")
Dim objReader As OleDbDataReader
objReader = ObjDatabase.SelectSQL("SELECT id FROM Admin WHERE Nome='" & ObjDatabase.Controlla_Stringa(Nome.Text) & "' AND Pwd='" & ObjDatabase.Controlla_Stringa(Pwd.Text) & "' ")
If Not objReader Is Nothing Then
Session("Admin") = "ok"
Response.Redirect("index.aspx")
Else
Errore.Visible = True
Errore.Text = "ERRORE"
End If
objReader.Close()
End Sub
End Class
mi da errore qui:
objReader.Close()
Object reference not set to an instance of an object.
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.NullReferenceException: Object reference not set to an instance of an object.
che vuol dire?