나는 티켓을 예약 한 승객의 세부 사항을 보여주는 gridview를 가지고 있습니다. 페이지로드 이벤트에 다음 코드가 있습니다.vb를 사용하여 asp.net에서 세션을 만드는 방법
Label1.Text = Session("Pid").ToString()
Dim Sql As String = "select * from Plist where Pid='" & Label1.Text & "'"
Try
con.ConnectionString = strCon
Dim cm As New SqlClient.SqlCommand(Sql, con)
con.Open()
cm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
Finally
If con.State = ConnectionState.Open Then
con.Close()
End If
End Try
이 오류가 무엇입니까 : System.NullReferenceException: Object reference not set to an instance of an object.
'con'는 어디에서 선언하고 인스턴스화 했습니까? – Tobsey
그리고 Session ("Pid")는 어디에 선언하셨습니까? – futile
여기에 스택 추적을 인쇄하면 어디에서 예외가 던져지고 있는지 정확히 알 수 있습니다. – gaurav