Hello everyone, Can anyone help me with this error above when I debug my web
app project in vstudio.net?? I can't figure it out! It was working fine for
months, and now all of a sudden it's not!!
This is the error:
[NullReferenceEx ception: Object reference not set to an instance of an
object.]
biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in
C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198
System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler
sourceControl, String eventArgument)
System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData)
System.Web.UI.P age.ProcessRequ estMain() +1292
And this is my code on that page:
Public Class searchsubject
Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
<System.Diagnos tics.DebuggerSt epThrough()> Private Sub
InitializeCompo nent()
End Sub
Dim search As Boolean = False
Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l
Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l
Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox
Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l
Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid
Protected WithEvents rptSubject As System.Web.UI.W ebControls.Repe ater
Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box
Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on
Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on
Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on
Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l
Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on
Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on
Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on
Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on
Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box
Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l
Protected WithEvents rptSubName As System.Web.UI.W ebControls.Repe ater
Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on
Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on
Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on
Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on
'NOTE: The following placeholder declaration is required by the Web Form
Designer.
'Do not delete or move it.
Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeCompo nent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then
'Clear all session variables but save the user role variable
Dim user As String = Session("Role")
Session.Abandon ()
Session("Role") = user
'Hide the datagrid
If Session("Role") = "User" Then
txtError.Visibl e = False
dgView.Visible = False
rptSubject.Visi ble = False
End If
Dim proc As Integer
'Loads existing information if user clicks 'Back to Subject
Menu' from any page.
'If subject_ID is missing then exit sub and don't load anything.
Try
proc = Request.QuerySt ring("subject_I D")
Catch err As SystemException
proc = 0
Exit Try
End Try
If proc = 0 Then
Else
txtSearch.Text = proc
Dim sender2 As System.Object
Dim e2 As System.EventArg s
btnSearch_Click (sender2, e2)
End If
If Session("Role") = "User" Then
lblSubject.Visi ble = False
txtSubject.Visi ble = False
btnSubject.Visi ble = False
End If
'IsPostBack
Else
End If
End Sub 'Page_load
Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e As
System.EventArg s) Handles btnSearch.Click
If txtSearch.Text = "" Then
Exit Sub
Else
If Session("Role") = "User" Then
Dim connstr As New SqlConnection(A pplication("cn" ))
'SELECTS information from the SUBJECT_DIAG_PR OCEDURE,
BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches
the number entered into the text box
Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE s
LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID ,
BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and
b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY
s.PROCEDURE_ID"
Dim da As New SqlDataAdapter( c, connstr)
Dim ds As New DataSet
Try
da.Fill(ds)
dgView.DataSour ce = ds
Catch myerr As SqlException
txtError.Text = myerr.Message
txtError.Visibl e = True
Finally
DataBind()
'Displays the datagrid and any returned information
dgView.Visible = True
search = True
End Try
Else
Dim connstr As New SqlConnection(A pplication("cn" ))
'SELECTS information from the SUBJECT_DIAG_PR OCEDURE,
BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches
the number entered into the text box
Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE s
LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID ,
BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and
b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY
s.PROCEDURE_ID"
Dim da As New SqlDataAdapter( c, connstr)
Dim ds As New DataSet
Try
da.Fill(ds, "SUBJECT")
rptSubject.Data Source = ds
Catch myerr As SqlException
txtError.Text = myerr.Message
txtError.Visibl e = True
Finally
DataBind()
'Displays the datagrid and any returned information
rptSubject.Visi ble = True
search = True
Dim dr As DataRow
Dim exist As Boolean = False
For Each dr In ds.Tables("SUBJ ECT").Rows
lblSearch.Visib le = False
exist = True
Exit For
Next
If exist = False Then
lblSearch.Text = "Subject number does not exist in
the database"
lblSearch.Visib le = True
End If
End Try
End If
End If
End Sub 'btnSearch_Clic k
Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As
RepeaterCommand EventArgs)
Dim test As String = e.CommandArgume nt
Response.Redire ct(test)
End Sub
Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As
System.EventArg s) Handles btnMain.Click
Response.Redire ct("index.aspx" )
End Sub
Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As
System.EventArg s) Handles btnLogOff.Click
Response.Redire ct("logout.aspx ")
End Sub
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As
System.EventArg s) Handles btnSubject.Clic k
If txtSubject.Text = "" Then
Exit Sub
Else
Dim connstr As New SqlConnection(A pplication("cn" ))
'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY,
PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number
entered into the text box
Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT
OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY
b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "'
and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and
p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D"
Dim da As New SqlDataAdapter( c, connstr)
Dim ds As New DataSet
Try
da.Fill(ds, "SUBJECT")
rptSubName.Data Source = ds
Catch myerr As SqlException
txtError.Text = myerr.Message
txtError.Visibl e = True
Finally
DataBind()
'Displays the datagrid and any returned information
rptSubName.Visi ble = True
search = True
Dim dr As DataRow
Dim exist As Boolean = False
For Each dr In ds.Tables("SUBJ ECT").Rows
lblSearch.Visib le = False
exist = True
Exit For
Next
If exist = False Then
lblSearch.Text = "Subject number does not exist in the
database"
lblSearch.Visib le = True
End If
End Try
End If
End Sub
End Class
Thanks! 8 2476
Which object is it not happy about? You posted a lot of code but what we
need is what line in btnSubject_Clic k is bad. What that error is telling
you is that the variable does not point to an object. Most likely some
function is returning "nothing" and then you try to use the variable that
references "nothing".
example:
Dim i as String
i = SomeFunction
i.lenth() <---- Puke cuase i = nothing
Function SomeFunction() as string
Return Nothing
End Function
Chris
"ST" <ST@discussions .microsoft.com> wrote in message
news:2E******** *************** ***********@mic rosoft.com... Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!! This is the error:
[NullReferenceEx ception: Object reference not set to an instance of an object.] biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) System.Web.UI.P age.ProcessRequ estMain() +1292
And this is my code on that page:
Public Class searchsubject Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub Dim search As Boolean = False Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid Protected WithEvents rptSubject As System.Web.UI.W ebControls.Repe ater Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l Protected WithEvents rptSubName As System.Web.UI.W ebControls.Repe ater Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on
'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeCompo nent() End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then 'Clear all session variables but save the user role variable
Dim user As String = Session("Role") Session.Abandon () Session("Role") = user
'Hide the datagrid If Session("Role") = "User" Then txtError.Visibl e = False dgView.Visible = False rptSubject.Visi ble = False End If Dim proc As Integer
'Loads existing information if user clicks 'Back to Subject Menu' from any page. 'If subject_ID is missing then exit sub and don't load anything. Try proc = Request.QuerySt ring("subject_I D") Catch err As SystemException proc = 0 Exit Try End Try If proc = 0 Then Else txtSearch.Text = proc Dim sender2 As System.Object Dim e2 As System.EventArg s btnSearch_Click (sender2, e2) End If If Session("Role") = "User" Then lblSubject.Visi ble = False txtSubject.Visi ble = False btnSubject.Visi ble = False End If 'IsPostBack Else
End If End Sub 'Page_load
Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSearch.Click
If txtSearch.Text = "" Then Exit Sub Else If Session("Role") = "User" Then Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE s LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID , BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY s.PROCEDURE_ID" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds) dgView.DataSour ce = ds
Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind()
'Displays the datagrid and any returned information dgView.Visible = True search = True End Try Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE s LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID , BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY s.PROCEDURE_ID" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubject.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubject.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try
End If End If
End Sub 'btnSearch_Clic k
Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As RepeaterCommand EventArgs) Dim test As String = e.CommandArgume nt Response.Redire ct(test) End Sub
Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As System.EventArg s) Handles btnMain.Click Response.Redire ct("index.aspx" ) End Sub
Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnLogOff.Click Response.Redire ct("logout.aspx ") End Sub
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
Thanks!
ooops sorry!! I meant to mark where it was before I sent it, and
forgot...anyway , it's marked below:
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As
System.EventArg s) Handles btnSubject.Clic k
If txtSubject.Text = "" Then
Exit Sub
Else
Dim connstr As New SqlConnection(A pplication("cn" ))
'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY,
PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the
number
entered into the text box
Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp
LEFT
OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID ,
BIOPSY
b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text &
"'
and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and
p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D"
Dim da As New SqlDataAdapter( c, connstr)
Dim ds As New DataSet
Try
da.Fill(ds, "SUBJECT")
rptSubName.Data Source = ds
Catch myerr As SqlException
txtError.Text = myerr.Message
txtError.Visibl e = True
Finally
DataBind()
'Displays the datagrid and any returned information
rptSubName.Visi ble = True
search = True
Dim dr As DataRow
Dim exist As Boolean = False
For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE
IT ERRORS OUT! dr=nothing when i debug??****
lblSearch.Visib le = False
exist = True
Exit For
Next
If exist = False Then
lblSearch.Text = "Subject number does not exist in the
database"
lblSearch.Visib le = True
End If
End Try
End If
End Sub
End Class
THANKS!!
"Chris, Master of All Things Insignifican" wrote: Which object is it not happy about? You posted a lot of code but what we need is what line in btnSubject_Clic k is bad. What that error is telling you is that the variable does not point to an object. Most likely some function is returning "nothing" and then you try to use the variable that references "nothing".
example:
Dim i as String i = SomeFunction i.lenth() <---- Puke cuase i = nothing
Function SomeFunction() as string Return Nothing End Function
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:2E******** *************** ***********@mic rosoft.com... Hello everyone, Can anyone help me with this error above when I debug my web app project in vstudio.net?? I can't figure it out! It was working fine for months, and now all of a sudden it's not!! This is the error:
[NullReferenceEx ception: Object reference not set to an instance of an object.] biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring eventArgument) System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) System.Web.UI.P age.ProcessRequ estMain() +1292
And this is my code on that page:
Public Class searchsubject Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub Dim search As Boolean = False Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid Protected WithEvents rptSubject As System.Web.UI.W ebControls.Repe ater Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l Protected WithEvents rptSubName As System.Web.UI.W ebControls.Repe ater Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on
'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeCompo nent() End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then 'Clear all session variables but save the user role variable
Dim user As String = Session("Role") Session.Abandon () Session("Role") = user
'Hide the datagrid If Session("Role") = "User" Then txtError.Visibl e = False dgView.Visible = False rptSubject.Visi ble = False End If Dim proc As Integer
'Loads existing information if user clicks 'Back to Subject Menu' from any page. 'If subject_ID is missing then exit sub and don't load anything. Try proc = Request.QuerySt ring("subject_I D") Catch err As SystemException proc = 0 Exit Try End Try If proc = 0 Then Else txtSearch.Text = proc Dim sender2 As System.Object Dim e2 As System.EventArg s btnSearch_Click (sender2, e2) End If If Session("Role") = "User" Then lblSubject.Visi ble = False txtSubject.Visi ble = False btnSubject.Visi ble = False End If 'IsPostBack Else
End If End Sub 'Page_load
Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e As System.EventArg s) Handles btnSearch.Click
If txtSearch.Text = "" Then Exit Sub Else If Session("Role") = "User" Then Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE s LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID , BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY s.PROCEDURE_ID" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds) dgView.DataSour ce = ds
Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind()
'Displays the datagrid and any returned information dgView.Visible = True search = True End Try Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE s LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID , BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY s.PROCEDURE_ID" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubject.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubject.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try
End If End If
End Sub 'btnSearch_Clic k
Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As RepeaterCommand EventArgs) Dim test As String = e.CommandArgume nt Response.Redire ct(test) End Sub
Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As System.EventArg s) Handles btnMain.Click Response.Redire ct("index.aspx" ) End Sub
Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnLogOff.Click Response.Redire ct("logout.aspx ") End Sub
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
Thanks!
For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE
IT ERRORS OUT! dr=nothing when i debug??****
lblSearch.Visib le = False
exist = True
Exit For
Next
Since you're not using the variable dr inside the loop, the garbage
collector might kick in and that might be a reason you're seeing a null
value inside the loop. Add a dummy reference to the variable dr before the
"next" and see if it still shows up as null when you enter the for loop
- Shuvro
--
This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm.
"ST" <ST@discussions .microsoft.com> wrote in message
news:47******** *************** ***********@mic rosoft.com... ooops sorry!! I meant to mark where it was before I sent it, and forgot...anyway , it's marked below:
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS
WHERE IT ERRORS OUT! dr=nothing when i debug??**** lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
THANKS!!
"Chris, Master of All Things Insignifican" wrote:
Which object is it not happy about? You posted a lot of code but what
we need is what line in btnSubject_Clic k is bad. What that error is
telling you is that the variable does not point to an object. Most likely some function is returning "nothing" and then you try to use the variable
that references "nothing".
example:
Dim i as String i = SomeFunction i.lenth() <---- Puke cuase i = nothing
Function SomeFunction() as string Return Nothing End Function
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:2E******** *************** ***********@mic rosoft.com... Hello everyone, Can anyone help me with this error above when I debug
my web app project in vstudio.net?? I can't figure it out! It was working
fine for months, and now all of a sudden it's not!! This is the error:
[NullReferenceEx ception: Object reference not set to an instance of an object.] biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e)
System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP o
stBackEvent(Str ing eventArgument) System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler sourceControl, String eventArgument) System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) System.Web.UI.P age.ProcessRequ estMain() +1292
And this is my code on that page:
Public Class searchsubject Inherits System.Web.UI.P age
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer. <System.Diagnos tics.DebuggerSt epThrough()> Private Sub InitializeCompo nent()
End Sub Dim search As Boolean = False Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l Protected WithEvents CheckBox1 As
System.Web.UI.W ebControls.Chec kBox Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid Protected WithEvents rptSubject As
System.Web.UI.W ebControls.Repe ater Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on Protected WithEvents txtSubject As
System.Web.UI.W ebControls.Text Box Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l Protected WithEvents rptSubName As
System.Web.UI.W ebControls.Repe ater Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on
'NOTE: The following placeholder declaration is required by the Web Form Designer. 'Do not delete or move it. Private designerPlaceho lderDeclaration As System.Object
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Init 'CODEGEN: This method call is required by the Web Form Designer 'Do not modify it using the code editor. InitializeCompo nent() End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArg s) Handles MyBase.Load
If Not IsPostBack Then 'Clear all session variables but save the user role
variable Dim user As String = Session("Role") Session.Abandon () Session("Role") = user
'Hide the datagrid If Session("Role") = "User" Then txtError.Visibl e = False dgView.Visible = False rptSubject.Visi ble = False End If Dim proc As Integer
'Loads existing information if user clicks 'Back to Subject Menu' from any page. 'If subject_ID is missing then exit sub and don't load anything. Try proc = Request.QuerySt ring("subject_I D") Catch err As SystemException proc = 0 Exit Try End Try If proc = 0 Then Else txtSearch.Text = proc Dim sender2 As System.Object Dim e2 As System.EventArg s btnSearch_Click (sender2, e2) End If If Session("Role") = "User" Then lblSubject.Visi ble = False txtSubject.Visi ble = False btnSubject.Visi ble = False End If 'IsPostBack Else
End If End Sub 'Page_load
Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e
As System.EventArg s) Handles btnSearch.Click
If txtSearch.Text = "" Then Exit Sub Else If Session("Role") = "User" Then Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id
matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE
s LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID =
bp.Procedure_ID , BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "'
and b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY s.PROCEDURE_ID" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds) dgView.DataSour ce = ds
Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind()
'Displays the datagrid and any returned information dgView.Visible = True search = True End Try Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id
matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE
s LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID =
bp.Procedure_ID , BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "'
and b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY s.PROCEDURE_ID" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubject.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubject.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist
in the database" lblSearch.Visib le = True End If End Try
End If End If
End Sub 'btnSearch_Clic k
Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As RepeaterCommand EventArgs) Dim test As String = e.CommandArgume nt Response.Redire ct(test) End Sub
Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As System.EventArg s) Handles btnMain.Click Response.Redire ct("index.aspx" ) End Sub
Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnLogOff.Click Response.Redire ct("logout.aspx ") End Sub
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE,
BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text
& "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in
the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
Thanks!
Well there is an easy solution to your problem. Why it is happening will be
hard for me to tell you right now. Couple of things I notice...
1. You have an Exit For in your For loop. This mean it will just look at
the first item and then leave. Why do a for each loop? You just want to
know if rows exist, do a Rows.Count.
Dim DT as DataTable
DT = ds.Tables("SUBJ ECT")
if (not DT is nothing) andalso DT.Rows.Count > 0 then
Exist = True
else
Exist = False
end if
If exist = False Then
lblSearch.Text = "Subject number does not exist in the
database"
lblSearch.Visib le = True
End If
2. To handle the error how you have it coded, just do this:
For Each dr In ds.Tables("SUBJ ECT").Rows
if dr is nothing then
else
lblSearch.Visib le = False
exist = True
Exit For
end if
Next
If exist = False Then
lblSearch.Text = "Subject number does not exist in the
database"
lblSearch.Visib le = True
End If
I got back to my number 1 point though, you shouldn't be using a For Each in
this case. What are you trying to accomplish in this loop?
Chris
"ST" <ST@discussions .microsoft.com> wrote in message
news:47******** *************** ***********@mic rosoft.com... ooops sorry!! I meant to mark where it was before I sent it, and forgot...anyway , it's marked below:
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE IT ERRORS OUT! dr=nothing when i debug??**** lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
THANKS!!
"Chris, Master of All Things Insignifican" wrote:
Which object is it not happy about? You posted a lot of code but what we need is what line in btnSubject_Clic k is bad. What that error is telling you is that the variable does not point to an object. Most likely some function is returning "nothing" and then you try to use the variable that references "nothing".
example:
Dim i as String i = SomeFunction i.lenth() <---- Puke cuase i = nothing
Function SomeFunction() as string Return Nothing End Function
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:2E******** *************** ***********@mic rosoft.com... > Hello everyone, Can anyone help me with this error above when I debug > my > web > app project in vstudio.net?? I can't figure it out! It was working > fine > for > months, and now all of a sudden it's not!! > This is the error: > > [NullReferenceEx ception: Object reference not set to an instance of an > object.] > biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in > C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) > > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring > eventArgument) > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler > sourceControl, String eventArgument) > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) > System.Web.UI.P age.ProcessRequ estMain() +1292 > > > And this is my code on that page: > > Public Class searchsubject > Inherits System.Web.UI.P age > > #Region " Web Form Designer Generated Code " > > 'This call is required by the Web Form Designer. > <System.Diagnos tics.DebuggerSt epThrough()> Private Sub > InitializeCompo nent() > > End Sub > Dim search As Boolean = False > Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l > Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox > Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l > Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid > Protected WithEvents rptSubject As > System.Web.UI.W ebControls.Repe ater > Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box > Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on > Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l > Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on > Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box > Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l > Protected WithEvents rptSubName As > System.Web.UI.W ebControls.Repe ater > Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on > Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on > Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on > > 'NOTE: The following placeholder declaration is required by the Web > Form > Designer. > 'Do not delete or move it. > Private designerPlaceho lderDeclaration As System.Object > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Init > 'CODEGEN: This method call is required by the Web Form Designer > 'Do not modify it using the code editor. > InitializeCompo nent() > End Sub > > #End Region > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Load > > If Not IsPostBack Then > 'Clear all session variables but save the user role variable > > Dim user As String = Session("Role") > Session.Abandon () > Session("Role") = user > > 'Hide the datagrid > If Session("Role") = "User" Then > txtError.Visibl e = False > dgView.Visible = False > rptSubject.Visi ble = False > End If > Dim proc As Integer > > 'Loads existing information if user clicks 'Back to Subject > Menu' from any page. > 'If subject_ID is missing then exit sub and don't load > anything. > Try > proc = Request.QuerySt ring("subject_I D") > Catch err As SystemException > proc = 0 > Exit Try > End Try > If proc = 0 Then > Else > txtSearch.Text = proc > Dim sender2 As System.Object > Dim e2 As System.EventArg s > btnSearch_Click (sender2, e2) > End If > If Session("Role") = "User" Then > lblSubject.Visi ble = False > txtSubject.Visi ble = False > btnSubject.Visi ble = False > End If > 'IsPostBack > Else > > End If > End Sub 'Page_load > > > Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e > As > System.EventArg s) Handles btnSearch.Click > > If txtSearch.Text = "" Then > Exit Sub > Else > If Session("Role") = "User" Then > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id > matches > the number entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > s > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = > bp.Procedure_ID , > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' > and > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY > s.PROCEDURE_ID" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds) > dgView.DataSour ce = ds > > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > > 'Displays the datagrid and any returned information > dgView.Visible = True > search = True > End Try > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id > matches > the number entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > s > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = > bp.Procedure_ID , > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' > and > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY > s.PROCEDURE_ID" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubject.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubject.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist > in > the database" > lblSearch.Visib le = True > End If > End Try > > End If > End If > > End Sub 'btnSearch_Clic k > > Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As > RepeaterCommand EventArgs) > Dim test As String = e.CommandArgume nt > Response.Redire ct(test) > End Sub > > Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As > System.EventArg s) Handles btnMain.Click > Response.Redire ct("index.aspx" ) > End Sub > > Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnLogOff.Click > Response.Redire ct("logout.aspx ") > End Sub > > Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnSubject.Clic k > If txtSubject.Text = "" Then > Exit Sub > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, > PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the > number > entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp > LEFT > OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , > BIOPSY > b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text > & > "' > and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and > p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubName.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubName.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist in > the > database" > lblSearch.Visib le = True > End If > End Try > End If > End Sub > End Class > > Thanks!
I didn't even catch that dr wasn't used in the loop. It has to be that
ds.Tables("SUBJ ECT") is returning "nothing" and then the calls to .Rows is
throwing the exception. I'd bet money dr has nothing to do with the
problem. Look at my post though, I think there is a better way to write the
code.
Chris
"Shuvro Mazumder [MSFT]" <sh*****@online .microsoft.com> wrote in message
news:e6******** ********@TK2MSF TNGP10.phx.gbl. .. For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE IT ERRORS OUT! dr=nothing when i debug??**** lblSearch.Visib le = False exist = True Exit For Next
Since you're not using the variable dr inside the loop, the garbage collector might kick in and that might be a reason you're seeing a null value inside the loop. Add a dummy reference to the variable dr before the "next" and see if it still shows up as null when you enter the for loop
- Shuvro
-- This posting is provided "AS IS" with no warranties, and confers no rights. Use of included script samples are subject to the terms specified at http://www.microsoft.com/info/cpyright.htm. "ST" <ST@discussions .microsoft.com> wrote in message news:47******** *************** ***********@mic rosoft.com... ooops sorry!! I meant to mark where it was before I sent it, and forgot...anyway , it's marked below:
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE IT ERRORS OUT! dr=nothing when i debug??**** lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
THANKS!!
"Chris, Master of All Things Insignifican" wrote:
> Which object is it not happy about? You posted a lot of code but what we > need is what line in btnSubject_Clic k is bad. What that error is telling > you is that the variable does not point to an object. Most likely some > function is returning "nothing" and then you try to use the variable that > references "nothing". > > example: > > Dim i as String > i = SomeFunction > i.lenth() <---- Puke cuase i = nothing > > Function SomeFunction() as string > Return Nothing > End Function > > Chris > > "ST" <ST@discussions .microsoft.com> wrote in message > news:2E******** *************** ***********@mic rosoft.com... > > Hello everyone, Can anyone help me with this error above when I debug my > > web > > app project in vstudio.net?? I can't figure it out! It was working fine > > for > > months, and now all of a sudden it's not!! > > This is the error: > > > > [NullReferenceEx ception: Object reference not set to an instance of > > an > > object.] > > biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) > > in > > C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 > > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) > > > > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP o stBackEvent(Str ing > > eventArgument) > > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler > > sourceControl, String eventArgument) > > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) > > System.Web.UI.P age.ProcessRequ estMain() +1292 > > > > > > And this is my code on that page: > > > > Public Class searchsubject > > Inherits System.Web.UI.P age > > > > #Region " Web Form Designer Generated Code " > > > > 'This call is required by the Web Form Designer. > > <System.Diagnos tics.DebuggerSt epThrough()> Private Sub > > InitializeCompo nent() > > > > End Sub > > Dim search As Boolean = False > > Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l > > Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox > > Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l > > Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid > > Protected WithEvents rptSubject As System.Web.UI.W ebControls.Repe ater > > Protected WithEvents txtSearch As > > System.Web.UI.W ebControls.Text Box > > Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on > > Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on > > Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on > > Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l > > Protected WithEvents btnNewProc As > > System.Web.UI.W ebControls.Butt on > > Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on > > Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on > > Protected WithEvents btnSubject As > > System.Web.UI.W ebControls.Butt on > > Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box > > Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l > > Protected WithEvents rptSubName As System.Web.UI.W ebControls.Repe ater > > Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on > > Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on > > Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on > > Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on > > > > 'NOTE: The following placeholder declaration is required by the > > Web > > Form > > Designer. > > 'Do not delete or move it. > > Private designerPlaceho lderDeclaration As System.Object > > > > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > > System.EventArg s) Handles MyBase.Init > > 'CODEGEN: This method call is required by the Web Form > > Designer > > 'Do not modify it using the code editor. > > InitializeCompo nent() > > End Sub > > > > #End Region > > > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As > > System.EventArg s) Handles MyBase.Load > > > > If Not IsPostBack Then > > 'Clear all session variables but save the user role variable > > > > Dim user As String = Session("Role") > > Session.Abandon () > > Session("Role") = user > > > > 'Hide the datagrid > > If Session("Role") = "User" Then > > txtError.Visibl e = False > > dgView.Visible = False > > rptSubject.Visi ble = False > > End If > > Dim proc As Integer > > > > 'Loads existing information if user clicks 'Back to > > Subject > > Menu' from any page. > > 'If subject_ID is missing then exit sub and don't load > > anything. > > Try > > proc = Request.QuerySt ring("subject_I D") > > Catch err As SystemException > > proc = 0 > > Exit Try > > End Try > > If proc = 0 Then > > Else > > txtSearch.Text = proc > > Dim sender2 As System.Object > > Dim e2 As System.EventArg s > > btnSearch_Click (sender2, e2) > > End If > > If Session("Role") = "User" Then > > lblSubject.Visi ble = False > > txtSubject.Visi ble = False > > btnSubject.Visi ble = False > > End If > > 'IsPostBack > > Else > > > > End If > > End Sub 'Page_load > > > > > > Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e As > > System.EventArg s) Handles btnSearch.Click > > > > If txtSearch.Text = "" Then > > Exit Sub > > Else > > If Session("Role") = "User" Then > > Dim connstr As New SqlConnection(A pplication("cn" )) > > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches > > the number entered into the text box > > Dim c As String = "Select * from > > SUBJECT_DIAG_PR OCEDURE s > > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID , > > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and > > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER > > BY > > s.PROCEDURE_ID" > > Dim da As New SqlDataAdapter( c, connstr) > > Dim ds As New DataSet > > Try > > da.Fill(ds) > > dgView.DataSour ce = ds > > > > Catch myerr As SqlException > > txtError.Text = myerr.Message > > txtError.Visibl e = True > > Finally > > DataBind() > > > > 'Displays the datagrid and any returned > > information > > dgView.Visible = True > > search = True > > End Try > > Else > > Dim connstr As New SqlConnection(A pplication("cn" )) > > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches > > the number entered into the text box > > Dim c As String = "Select * from > > SUBJECT_DIAG_PR OCEDURE s > > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = bp.Procedure_ID , > > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' and > > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER > > BY > > s.PROCEDURE_ID" > > Dim da As New SqlDataAdapter( c, connstr) > > Dim ds As New DataSet > > Try > > da.Fill(ds, "SUBJECT") > > rptSubject.Data Source = ds > > Catch myerr As SqlException > > txtError.Text = myerr.Message > > txtError.Visibl e = True > > Finally > > DataBind() > > 'Displays the datagrid and any returned > > information > > rptSubject.Visi ble = True > > search = True > > Dim dr As DataRow > > Dim exist As Boolean = False > > For Each dr In ds.Tables("SUBJ ECT").Rows > > lblSearch.Visib le = False > > exist = True > > Exit For > > Next > > If exist = False Then > > lblSearch.Text = "Subject number does not > > exist in > > the database" > > lblSearch.Visib le = True > > End If > > End Try > > > > End If > > End If > > > > End Sub 'btnSearch_Clic k > > > > Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As > > RepeaterCommand EventArgs) > > Dim test As String = e.CommandArgume nt > > Response.Redire ct(test) > > End Sub > > > > Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As > > System.EventArg s) Handles btnMain.Click > > Response.Redire ct("index.aspx" ) > > End Sub > > > > Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As > > System.EventArg s) Handles btnLogOff.Click > > Response.Redire ct("logout.aspx ") > > End Sub > > > > Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As > > System.EventArg s) Handles btnSubject.Clic k > > If txtSubject.Text = "" Then > > Exit Sub > > Else > > Dim connstr As New SqlConnection(A pplication("cn" )) > > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, > > PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches > > the > > number > > entered into the text box > > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > > sdp > > LEFT > > OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , > > BIOPSY > > b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & > > txtSubject.Text & > > "' > > and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and > > p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" > > Dim da As New SqlDataAdapter( c, connstr) > > Dim ds As New DataSet > > Try > > da.Fill(ds, "SUBJECT") > > rptSubName.Data Source = ds > > Catch myerr As SqlException > > txtError.Text = myerr.Message > > txtError.Visibl e = True > > Finally > > DataBind() > > 'Displays the datagrid and any returned information > > rptSubName.Visi ble = True > > search = True > > Dim dr As DataRow > > Dim exist As Boolean = False > > For Each dr In ds.Tables("SUBJ ECT").Rows > > lblSearch.Visib le = False > > exist = True > > Exit For > > Next > > If exist = False Then > > lblSearch.Text = "Subject number does not exist in the > > database" > > lblSearch.Visib le = True > > End If > > End Try > > End If > > End Sub > > End Class > > > > Thanks! > > >
Hi! I'm going to take a look at your suggestions right now and get back to
you. Oh, I'm actually taking over for someone else who wrote this code. I
just recently started trying to work with this code...and I'm also a newbie
web developer (trying to learn everything on my own)! Thanks so much for the
help! I'll be back with a response shortly...
"Chris, Master of All Things Insignifican" wrote: Well there is an easy solution to your problem. Why it is happening will be hard for me to tell you right now. Couple of things I notice...
1. You have an Exit For in your For loop. This mean it will just look at the first item and then leave. Why do a for each loop? You just want to know if rows exist, do a Rows.Count. Dim DT as DataTable DT = ds.Tables("SUBJ ECT") if (not DT is nothing) andalso DT.Rows.Count > 0 then Exist = True else Exist = False end if If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If
2. To handle the error how you have it coded, just do this: For Each dr In ds.Tables("SUBJ ECT").Rows if dr is nothing then
else lblSearch.Visib le = False exist = True Exit For end if Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If
I got back to my number 1 point though, you shouldn't be using a For Each in this case. What are you trying to accomplish in this loop?
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:47******** *************** ***********@mic rosoft.com... ooops sorry!! I meant to mark where it was before I sent it, and forgot...anyway , it's marked below:
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE IT ERRORS OUT! dr=nothing when i debug??**** lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
THANKS!!
"Chris, Master of All Things Insignifican" wrote:
Which object is it not happy about? You posted a lot of code but what we need is what line in btnSubject_Clic k is bad. What that error is telling you is that the variable does not point to an object. Most likely some function is returning "nothing" and then you try to use the variable that references "nothing".
example:
Dim i as String i = SomeFunction i.lenth() <---- Puke cuase i = nothing
Function SomeFunction() as string Return Nothing End Function
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:2E******** *************** ***********@mic rosoft.com... > Hello everyone, Can anyone help me with this error above when I debug > my > web > app project in vstudio.net?? I can't figure it out! It was working > fine > for > months, and now all of a sudden it's not!! > This is the error: > > [NullReferenceEx ception: Object reference not set to an instance of an > object.] > biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in > C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) > > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring > eventArgument) > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler > sourceControl, String eventArgument) > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) > System.Web.UI.P age.ProcessRequ estMain() +1292 > > > And this is my code on that page: > > Public Class searchsubject > Inherits System.Web.UI.P age > > #Region " Web Form Designer Generated Code " > > 'This call is required by the Web Form Designer. > <System.Diagnos tics.DebuggerSt epThrough()> Private Sub > InitializeCompo nent() > > End Sub > Dim search As Boolean = False > Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l > Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox > Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l > Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid > Protected WithEvents rptSubject As > System.Web.UI.W ebControls.Repe ater > Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box > Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on > Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l > Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on > Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box > Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l > Protected WithEvents rptSubName As > System.Web.UI.W ebControls.Repe ater > Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on > Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on > Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on > > 'NOTE: The following placeholder declaration is required by the Web > Form > Designer. > 'Do not delete or move it. > Private designerPlaceho lderDeclaration As System.Object > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Init > 'CODEGEN: This method call is required by the Web Form Designer > 'Do not modify it using the code editor. > InitializeCompo nent() > End Sub > > #End Region > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Load > > If Not IsPostBack Then > 'Clear all session variables but save the user role variable > > Dim user As String = Session("Role") > Session.Abandon () > Session("Role") = user > > 'Hide the datagrid > If Session("Role") = "User" Then > txtError.Visibl e = False > dgView.Visible = False > rptSubject.Visi ble = False > End If > Dim proc As Integer > > 'Loads existing information if user clicks 'Back to Subject > Menu' from any page. > 'If subject_ID is missing then exit sub and don't load > anything. > Try > proc = Request.QuerySt ring("subject_I D") > Catch err As SystemException > proc = 0 > Exit Try > End Try > If proc = 0 Then > Else > txtSearch.Text = proc > Dim sender2 As System.Object > Dim e2 As System.EventArg s > btnSearch_Click (sender2, e2) > End If > If Session("Role") = "User" Then > lblSubject.Visi ble = False > txtSubject.Visi ble = False > btnSubject.Visi ble = False > End If > 'IsPostBack > Else > > End If > End Sub 'Page_load > > > Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e > As > System.EventArg s) Handles btnSearch.Click > > If txtSearch.Text = "" Then > Exit Sub > Else > If Session("Role") = "User" Then > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id > matches > the number entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > s > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = > bp.Procedure_ID , > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' > and > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY > s.PROCEDURE_ID" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds) > dgView.DataSour ce = ds > > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > > 'Displays the datagrid and any returned information > dgView.Visible = True > search = True > End Try > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id > matches > the number entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > s > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = > bp.Procedure_ID , > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' > and > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY > s.PROCEDURE_ID" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubject.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubject.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist > in > the database" > lblSearch.Visib le = True > End If > End Try > > End If > End If > > End Sub 'btnSearch_Clic k > > Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As > RepeaterCommand EventArgs) > Dim test As String = e.CommandArgume nt > Response.Redire ct(test) > End Sub > > Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As > System.EventArg s) Handles btnMain.Click > Response.Redire ct("index.aspx" ) > End Sub > > Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnLogOff.Click > Response.Redire ct("logout.aspx ") > End Sub > > Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnSubject.Clic k > If txtSubject.Text = "" Then > Exit Sub > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, > PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the > number > entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp > LEFT > OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , > BIOPSY > b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text > & > "' > and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and > p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubName.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubName.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist in > the > database" > lblSearch.Visib le = True > End If > End Try > End If > End Sub > End Class > > Thanks!
hmmm, well that got rid of the error i was getting before, but now it's not
searching for the subject ID i typed it...i just keeps saying "subject does
not exist" for any ID i search for.
I also noticed that the "login failed for biopsyuser" is showing up. the
way the web app works is that anyone that is logged in as a biopsyuser CANNOT
search, and anyone logged in who belongs to a superuser group CAN run this
search. So I'm thinking this might have something to do with it...
"Chris, Master of All Things Insignifican" wrote: Well there is an easy solution to your problem. Why it is happening will be hard for me to tell you right now. Couple of things I notice...
1. You have an Exit For in your For loop. This mean it will just look at the first item and then leave. Why do a for each loop? You just want to know if rows exist, do a Rows.Count. Dim DT as DataTable DT = ds.Tables("SUBJ ECT") if (not DT is nothing) andalso DT.Rows.Count > 0 then Exist = True else Exist = False end if If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If
2. To handle the error how you have it coded, just do this: For Each dr In ds.Tables("SUBJ ECT").Rows if dr is nothing then
else lblSearch.Visib le = False exist = True Exit For end if Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If
I got back to my number 1 point though, you shouldn't be using a For Each in this case. What are you trying to accomplish in this loop?
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:47******** *************** ***********@mic rosoft.com... ooops sorry!! I meant to mark where it was before I sent it, and forgot...anyway , it's marked below:
Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As System.EventArg s) Handles btnSubject.Clic k If txtSubject.Text = "" Then Exit Sub Else Dim connstr As New SqlConnection(A pplication("cn" )) 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the number entered into the text box Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , BIOPSY b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text & "' and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" Dim da As New SqlDataAdapter( c, connstr) Dim ds As New DataSet Try da.Fill(ds, "SUBJECT") rptSubName.Data Source = ds Catch myerr As SqlException txtError.Text = myerr.Message txtError.Visibl e = True Finally DataBind() 'Displays the datagrid and any returned information rptSubName.Visi ble = True search = True Dim dr As DataRow Dim exist As Boolean = False For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS WHERE IT ERRORS OUT! dr=nothing when i debug??**** lblSearch.Visib le = False exist = True Exit For Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If End Try End If End Sub End Class
THANKS!!
"Chris, Master of All Things Insignifican" wrote:
Which object is it not happy about? You posted a lot of code but what we need is what line in btnSubject_Clic k is bad. What that error is telling you is that the variable does not point to an object. Most likely some function is returning "nothing" and then you try to use the variable that references "nothing".
example:
Dim i as String i = SomeFunction i.lenth() <---- Puke cuase i = nothing
Function SomeFunction() as string Return Nothing End Function
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:2E******** *************** ***********@mic rosoft.com... > Hello everyone, Can anyone help me with this error above when I debug > my > web > app project in vstudio.net?? I can't figure it out! It was working > fine > for > months, and now all of a sudden it's not!! > This is the error: > > [NullReferenceEx ception: Object reference not set to an instance of an > object.] > biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) in > C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) > > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring > eventArgument) > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler > sourceControl, String eventArgument) > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection postData) > System.Web.UI.P age.ProcessRequ estMain() +1292 > > > And this is my code on that page: > > Public Class searchsubject > Inherits System.Web.UI.P age > > #Region " Web Form Designer Generated Code " > > 'This call is required by the Web Form Designer. > <System.Diagnos tics.DebuggerSt epThrough()> Private Sub > InitializeCompo nent() > > End Sub > Dim search As Boolean = False > Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l > Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l > Protected WithEvents CheckBox1 As System.Web.UI.W ebControls.Chec kBox > Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l > Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid > Protected WithEvents rptSubject As > System.Web.UI.W ebControls.Repe ater > Protected WithEvents txtSearch As System.Web.UI.W ebControls.Text Box > Protected WithEvents btnUpdate As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnSearch As System.Web.UI.W ebControls.Butt on > Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l > Protected WithEvents btnNewProc As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnLogOff As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnSubject As System.Web.UI.W ebControls.Butt on > Protected WithEvents txtSubject As System.Web.UI.W ebControls.Text Box > Protected WithEvents lblSubject As System.Web.UI.W ebControls.Labe l > Protected WithEvents rptSubName As > System.Web.UI.W ebControls.Repe ater > Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on > Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on > Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on > Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on > > 'NOTE: The following placeholder declaration is required by the Web > Form > Designer. > 'Do not delete or move it. > Private designerPlaceho lderDeclaration As System.Object > > > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Init > 'CODEGEN: This method call is required by the Web Form Designer > 'Do not modify it using the code editor. > InitializeCompo nent() > End Sub > > #End Region > > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As > System.EventArg s) Handles MyBase.Load > > If Not IsPostBack Then > 'Clear all session variables but save the user role variable > > Dim user As String = Session("Role") > Session.Abandon () > Session("Role") = user > > 'Hide the datagrid > If Session("Role") = "User" Then > txtError.Visibl e = False > dgView.Visible = False > rptSubject.Visi ble = False > End If > Dim proc As Integer > > 'Loads existing information if user clicks 'Back to Subject > Menu' from any page. > 'If subject_ID is missing then exit sub and don't load > anything. > Try > proc = Request.QuerySt ring("subject_I D") > Catch err As SystemException > proc = 0 > Exit Try > End Try > If proc = 0 Then > Else > txtSearch.Text = proc > Dim sender2 As System.Object > Dim e2 As System.EventArg s > btnSearch_Click (sender2, e2) > End If > If Session("Role") = "User" Then > lblSubject.Visi ble = False > txtSubject.Visi ble = False > btnSubject.Visi ble = False > End If > 'IsPostBack > Else > > End If > End Sub 'Page_load > > > Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal e > As > System.EventArg s) Handles btnSearch.Click > > If txtSearch.Text = "" Then > Exit Sub > Else > If Session("Role") = "User" Then > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id > matches > the number entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > s > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = > bp.Procedure_ID , > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' > and > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY > s.PROCEDURE_ID" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds) > dgView.DataSour ce = ds > > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > > 'Displays the datagrid and any returned information > dgView.Visible = True > search = True > End Try > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id > matches > the number entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE > s > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = > bp.Procedure_ID , > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' > and > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER BY > s.PROCEDURE_ID" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubject.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubject.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist > in > the database" > lblSearch.Visib le = True > End If > End Try > > End If > End If > > End Sub 'btnSearch_Clic k > > Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As > RepeaterCommand EventArgs) > Dim test As String = e.CommandArgume nt > Response.Redire ct(test) > End Sub > > Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As > System.EventArg s) Handles btnMain.Click > Response.Redire ct("index.aspx" ) > End Sub > > Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnLogOff.Click > Response.Redire ct("logout.aspx ") > End Sub > > Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnSubject.Clic k > If txtSubject.Text = "" Then > Exit Sub > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, > PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the > number > entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp > LEFT > OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , > BIOPSY > b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text > & > "' > and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and > p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubName.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubName.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist in > the > database" > lblSearch.Visib le = True > End If > End Try > End If > End Sub > End Class > > Thanks!
In your case it means that the dataset does not contain the "SUBJECT" table.
You will have to research where the "SUBJECT" table was suppose to get added
to the dataset. How are you logging into your database? Sounds like the
database is rejecting your user maybe?
Chris
"ST" <ST@discussions .microsoft.com> wrote in message
news:41******** *************** ***********@mic rosoft.com... hmmm, well that got rid of the error i was getting before, but now it's not searching for the subject ID i typed it...i just keeps saying "subject does not exist" for any ID i search for.
I also noticed that the "login failed for biopsyuser" is showing up. the way the web app works is that anyone that is logged in as a biopsyuser CANNOT search, and anyone logged in who belongs to a superuser group CAN run this search. So I'm thinking this might have something to do with it...
"Chris, Master of All Things Insignifican" wrote:
Well there is an easy solution to your problem. Why it is happening will be hard for me to tell you right now. Couple of things I notice...
1. You have an Exit For in your For loop. This mean it will just look at the first item and then leave. Why do a for each loop? You just want to know if rows exist, do a Rows.Count. Dim DT as DataTable DT = ds.Tables("SUBJ ECT") if (not DT is nothing) andalso DT.Rows.Count > 0 then Exist = True else Exist = False end if If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If
2. To handle the error how you have it coded, just do this: For Each dr In ds.Tables("SUBJ ECT").Rows if dr is nothing then
else lblSearch.Visib le = False exist = True Exit For end if Next If exist = False Then lblSearch.Text = "Subject number does not exist in the database" lblSearch.Visib le = True End If
I got back to my number 1 point though, you shouldn't be using a For Each in this case. What are you trying to accomplish in this loop?
Chris
"ST" <ST@discussions .microsoft.com> wrote in message news:47******** *************** ***********@mic rosoft.com... > ooops sorry!! I meant to mark where it was before I sent it, and > forgot...anyway , it's marked below: > > Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As > System.EventArg s) Handles btnSubject.Clic k > If txtSubject.Text = "" Then > Exit Sub > Else > Dim connstr As New SqlConnection(A pplication("cn" )) > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, > BIOPSY, > PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches the > number > entered into the text box > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE sdp > LEFT > OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = bp.Procedure_ID , > BIOPSY > b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & txtSubject.Text > & > "' > and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID and > p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" > Dim da As New SqlDataAdapter( c, connstr) > Dim ds As New DataSet > Try > da.Fill(ds, "SUBJECT") > rptSubName.Data Source = ds > Catch myerr As SqlException > txtError.Text = myerr.Message > txtError.Visibl e = True > Finally > DataBind() > 'Displays the datagrid and any returned information > rptSubName.Visi ble = True > search = True > Dim dr As DataRow > Dim exist As Boolean = False > For Each dr In ds.Tables("SUBJ ECT").Rows '>>**THIS IS > WHERE > IT ERRORS OUT! dr=nothing when i debug??**** > lblSearch.Visib le = False > exist = True > Exit For > Next > If exist = False Then > lblSearch.Text = "Subject number does not exist in > the > database" > lblSearch.Visib le = True > End If > End Try > End If > End Sub > End Class > > THANKS!! > > "Chris, Master of All Things Insignifican" wrote: > >> Which object is it not happy about? You posted a lot of code but what >> we >> need is what line in btnSubject_Clic k is bad. What that error is >> telling >> you is that the variable does not point to an object. Most likely >> some >> function is returning "nothing" and then you try to use the variable >> that >> references "nothing". >> >> example: >> >> Dim i as String >> i = SomeFunction >> i.lenth() <---- Puke cuase i = nothing >> >> Function SomeFunction() as string >> Return Nothing >> End Function >> >> Chris >> >> "ST" <ST@discussions .microsoft.com> wrote in message >> news:2E******** *************** ***********@mic rosoft.com... >> > Hello everyone, Can anyone help me with this error above when I >> > debug >> > my >> > web >> > app project in vstudio.net?? I can't figure it out! It was working >> > fine >> > for >> > months, and now all of a sudden it's not!! >> > This is the error: >> > >> > [NullReferenceEx ception: Object reference not set to an instance of >> > an >> > object.] >> > biopsy.searchsu bject.btnSubjec t_Click(Object Sender, EventArgs e) >> > in >> > C:\INetPub\WWWR oot\biopsy\sear chsubject.aspx. vb:198 >> > System.Web.UI.W ebControls.Butt on.OnClick(Even tArgs e) >> > >> > System.Web.UI.W ebControls.Butt on.System.Web.U I.IPostBackEven tHandler.RaiseP ostBackEvent(St ring >> > eventArgument) >> > System.Web.UI.P age.RaisePostBa ckEvent(IPostBa ckEventHandler >> > sourceControl, String eventArgument) >> > System.Web.UI.P age.RaisePostBa ckEvent(NameVal ueCollection >> > postData) >> > System.Web.UI.P age.ProcessRequ estMain() +1292 >> > >> > >> > And this is my code on that page: >> > >> > Public Class searchsubject >> > Inherits System.Web.UI.P age >> > >> > #Region " Web Form Designer Generated Code " >> > >> > 'This call is required by the Web Form Designer. >> > <System.Diagnos tics.DebuggerSt epThrough()> Private Sub >> > InitializeCompo nent() >> > >> > End Sub >> > Dim search As Boolean = False >> > Protected WithEvents Label2 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label4 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label5 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label6 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label7 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label8 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label9 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label10 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label11 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents Label12 As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents CheckBox1 As >> > System.Web.UI.W ebControls.Chec kBox >> > Protected WithEvents txtError As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents dgView As System.Web.UI.W ebControls.Data Grid >> > Protected WithEvents rptSubject As >> > System.Web.UI.W ebControls.Repe ater >> > Protected WithEvents txtSearch As >> > System.Web.UI.W ebControls.Text Box >> > Protected WithEvents btnUpdate As >> > System.Web.UI.W ebControls.Butt on >> > Protected WithEvents btnView As System.Web.UI.W ebControls.Butt on >> > Protected WithEvents btnSearch As >> > System.Web.UI.W ebControls.Butt on >> > Protected WithEvents lblSearch As System.Web.UI.W ebControls.Labe l >> > Protected WithEvents btnNewProc As >> > System.Web.UI.W ebControls.Butt on >> > Protected WithEvents btnMain As System.Web.UI.W ebControls.Butt on >> > Protected WithEvents btnLogOff As >> > System.Web.UI.W ebControls.Butt on >> > Protected WithEvents btnSubject As >> > System.Web.UI.W ebControls.Butt on >> > Protected WithEvents txtSubject As >> > System.Web.UI.W ebControls.Text Box >> > Protected WithEvents lblSubject As >> > System.Web.UI.W ebControls.Labe l >> > Protected WithEvents rptSubName As >> > System.Web.UI.W ebControls.Repe ater >> > Protected WithEvents button1 As System.Web.UI.W ebControls.Butt on >> > Protected WithEvents button2 As System.Web.UI.W ebControls.Butt on >> > Protected WithEvents button3 As System.Web.UI.W ebControls.Butt on >> > Protected WithEvents btnDNA As System.Web.UI.W ebControls.Butt on >> > >> > 'NOTE: The following placeholder declaration is required by the >> > Web >> > Form >> > Designer. >> > 'Do not delete or move it. >> > Private designerPlaceho lderDeclaration As System.Object >> > >> > >> > Private Sub Page_Init(ByVal sender As System.Object, ByVal e As >> > System.EventArg s) Handles MyBase.Init >> > 'CODEGEN: This method call is required by the Web Form >> > Designer >> > 'Do not modify it using the code editor. >> > InitializeCompo nent() >> > End Sub >> > >> > #End Region >> > >> > Private Sub Page_Load(ByVal sender As System.Object, ByVal e As >> > System.EventArg s) Handles MyBase.Load >> > >> > If Not IsPostBack Then >> > 'Clear all session variables but save the user role >> > variable >> > >> > Dim user As String = Session("Role") >> > Session.Abandon () >> > Session("Role") = user >> > >> > 'Hide the datagrid >> > If Session("Role") = "User" Then >> > txtError.Visibl e = False >> > dgView.Visible = False >> > rptSubject.Visi ble = False >> > End If >> > Dim proc As Integer >> > >> > 'Loads existing information if user clicks 'Back to >> > Subject >> > Menu' from any page. >> > 'If subject_ID is missing then exit sub and don't load >> > anything. >> > Try >> > proc = Request.QuerySt ring("subject_I D") >> > Catch err As SystemException >> > proc = 0 >> > Exit Try >> > End Try >> > If proc = 0 Then >> > Else >> > txtSearch.Text = proc >> > Dim sender2 As System.Object >> > Dim e2 As System.EventArg s >> > btnSearch_Click (sender2, e2) >> > End If >> > If Session("Role") = "User" Then >> > lblSubject.Visi ble = False >> > txtSubject.Visi ble = False >> > btnSubject.Visi ble = False >> > End If >> > 'IsPostBack >> > Else >> > >> > End If >> > End Sub 'Page_load >> > >> > >> > Private Sub btnSearch_Click (ByVal sender As System.Object, ByVal >> > e >> > As >> > System.EventArg s) Handles btnSearch.Click >> > >> > If txtSearch.Text = "" Then >> > Exit Sub >> > Else >> > If Session("Role") = "User" Then >> > Dim connstr As New SqlConnection(A pplication("cn" )) >> > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, >> > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id >> > matches >> > the number entered into the text box >> > Dim c As String = "Select * from >> > SUBJECT_DIAG_PR OCEDURE >> > s >> > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = >> > bp.Procedure_ID , >> > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' >> > and >> > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER >> > BY >> > s.PROCEDURE_ID" >> > Dim da As New SqlDataAdapter( c, connstr) >> > Dim ds As New DataSet >> > Try >> > da.Fill(ds) >> > dgView.DataSour ce = ds >> > >> > Catch myerr As SqlException >> > txtError.Text = myerr.Message >> > txtError.Visibl e = True >> > Finally >> > DataBind() >> > >> > 'Displays the datagrid and any returned >> > information >> > dgView.Visible = True >> > search = True >> > End Try >> > Else >> > Dim connstr As New SqlConnection(A pplication("cn" )) >> > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, >> > BIOPSY, PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id >> > matches >> > the number entered into the text box >> > Dim c As String = "Select * from >> > SUBJECT_DIAG_PR OCEDURE >> > s >> > LEFT OUTER JOIN BIOPSY_PATHOLOG Y bp ON s.Procedure_ID = >> > bp.Procedure_ID , >> > BIOPSY b, PHYSICIAN p where s.subject_id = '" & txtSearch.Text & "' >> > and >> > b.BIOPSY_ID = s.BIOPSY_ID and p.PHYSICIAN_ID = s.PHYSICIAN_ID ORDER >> > BY >> > s.PROCEDURE_ID" >> > Dim da As New SqlDataAdapter( c, connstr) >> > Dim ds As New DataSet >> > Try >> > da.Fill(ds, "SUBJECT") >> > rptSubject.Data Source = ds >> > Catch myerr As SqlException >> > txtError.Text = myerr.Message >> > txtError.Visibl e = True >> > Finally >> > DataBind() >> > 'Displays the datagrid and any returned >> > information >> > rptSubject.Visi ble = True >> > search = True >> > Dim dr As DataRow >> > Dim exist As Boolean = False >> > For Each dr In ds.Tables("SUBJ ECT").Rows >> > lblSearch.Visib le = False >> > exist = True >> > Exit For >> > Next >> > If exist = False Then >> > lblSearch.Text = "Subject number does not >> > exist >> > in >> > the database" >> > lblSearch.Visib le = True >> > End If >> > End Try >> > >> > End If >> > End If >> > >> > End Sub 'btnSearch_Clic k >> > >> > Public Sub rpt_ItemCommand (ByVal Sender As Object, ByVal e As >> > RepeaterCommand EventArgs) >> > Dim test As String = e.CommandArgume nt >> > Response.Redire ct(test) >> > End Sub >> > >> > Private Sub btnMain_Click(B yVal Sender As Object, ByVal e As >> > System.EventArg s) Handles btnMain.Click >> > Response.Redire ct("index.aspx" ) >> > End Sub >> > >> > Private Sub btnLogOff_Click (ByVal Sender As Object, ByVal e As >> > System.EventArg s) Handles btnLogOff.Click >> > Response.Redire ct("logout.aspx ") >> > End Sub >> > >> > Private Sub btnSubject_Clic k(ByVal Sender As Object, ByVal e As >> > System.EventArg s) Handles btnSubject.Clic k >> > If txtSubject.Text = "" Then >> > Exit Sub >> > Else >> > Dim connstr As New SqlConnection(A pplication("cn" )) >> > 'SELECTS information from the SUBJECT_DIAG_PR OCEDURE, >> > BIOPSY, >> > PHYSICIAN and BIOPSY_PATHOLOG Y tables where the subject_id matches >> > the >> > number >> > entered into the text box >> > Dim c As String = "Select * from SUBJECT_DIAG_PR OCEDURE >> > sdp >> > LEFT >> > OUTER JOIN BIOPSY_PATHOLOG Y bp ON sdp.Procedure_I D = >> > bp.Procedure_ID , >> > BIOPSY >> > b, PHYSICIAN p, SUBJECT s where s.SUBJECT_LNAME = '" & >> > txtSubject.Text >> > & >> > "' >> > and sdp.SUBJECT_ID = s.SUBJECT_ID and b.BIOPSY_ID = sdp.BIOPSY_ID >> > and >> > p.PHYSICIAN_ID = sdp.PHYSICIAN_I D ORDER BY sdp.PROCEDURE_I D" >> > Dim da As New SqlDataAdapter( c, connstr) >> > Dim ds As New DataSet >> > Try >> > da.Fill(ds, "SUBJECT") >> > rptSubName.Data Source = ds >> > Catch myerr As SqlException >> > txtError.Text = myerr.Message >> > txtError.Visibl e = True >> > Finally >> > DataBind() >> > 'Displays the datagrid and any returned information >> > rptSubName.Visi ble = True >> > search = True >> > Dim dr As DataRow >> > Dim exist As Boolean = False >> > For Each dr In ds.Tables("SUBJ ECT").Rows >> > lblSearch.Visib le = False >> > exist = True >> > Exit For >> > Next >> > If exist = False Then >> > lblSearch.Text = "Subject number does not exist >> > in >> > the >> > database" >> > lblSearch.Visib le = True >> > End If >> > End Try >> > End If >> > End Sub >> > End Class >> > >> > Thanks! >> >> >> This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics |
by: mike p. |
last post by:
I have a docbook xml file, and am using standard docbook 1.61.3 xsl
stylesheets to do xhtml transform. Transform works fine when using
MSXML.
When I try to do the following using asp.net 1.1:
private void Page_Load(object sender, System.EventArgs e) {
// load content
XslTransform trans = new XslTransform();
|
by: Ben |
last post by:
I have several pages written in aspx, but sometime the aspx page return the
following error. And it hapeen, the whole web application gives this error,
that means all the aspx files get affected. Any ideas?
Here is the error:
Server Error in '/' Application.
--------------------------------------------------------------------------------
Object reference not set to an instance of an object.
Description: An unhandled exception occurred...
|
by: Arapi |
last post by:
I am having a very strange problem with my asp.net application. I am
getting error: 'Object reference not set to an instance of an object' when I
run my app from my hosting company. I have installed my application on
three different machines (including a brand new install of winxp, vs2003) at
our offices and everything seems to work fine. What could be wrong with the
server at hosting company. When i speak to them about the problem they...
|
by: Giovanni Bassi |
last post by:
Hello All,
I have encountered a problem.
I am using visual inheritance and my base form adds an event handler on Form
Load using the AddHandler Keyword.
The problem is that if the Event Handler code is there, when I create the
inherited form I get the error "Object Reference not set to an instance of
an object". If it is not I get no error.
I have tried leaving this code in the forms Sub New, but it produces the
|
by: Adriano |
last post by:
Hello,
when I try to print something, either DataGrid or from Crystal Report viever
the folowing error message appears and cancels printing:
Object reference not set to an instance of an object :((((
Anyone pls help me to solve this problem!!!
thanks in advance,
| |
by: Hennie |
last post by:
I Get the following error all of a sudden:
I do not know what is wrong or where to start looking.
I added the Debug="true" directive at the top of the page, but it does not
help at all.
What can the problem be?
This is the complet error message:
Server Error in '/MailListManager' Application.
----------------------------------------------------------------------------
|
by: Varangian |
last post by:
ImageButton ship;
ship = new ImageButton;
for (int i=0; i<5; i++)
{
ship.ImageUrl = pathofImage;
ship.ID = "ShipNo" + i.ToString();
ship.Click += new ImageClickEventHandler(this.ImageBtn_Click);
this.Form1.Controls.Add(ship);
}
|
by: Bob |
last post by:
Hello,
I'm starting with vb.net and i get this error:
Object reference not set to an instance of an object
Dim t() As Integer
For i = 0 To 1000
t(i) = i
Next
|
by: kalaivanan |
last post by:
hi,
i am a beginner in c#.
i have theoretical knowledge about object, reference and instance.
but i want to know clearly about what is an object, reference and
instance.
can any one help me?
or is there any article which can explain it.
kalaivanan
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look !
Part I. Meaning of...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it.
First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
| |
by: Oralloy |
last post by:
Hello folks,
I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>".
The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed.
This is as boiled down as I can make it.
Here is my compilation command:
g++-12 -std=c++20 -Wnarrowing bit_field.cpp
Here is the code in...
|
by: Hystou |
last post by:
Overview:
Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
|
by: agi2029 |
last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own....
Now, this would greatly impact the work of software developers. The idea...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules.
He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms.
Adolph will...
|
by: conductexam |
last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one.
At the time of converting from word file to html my equations which are in the word document file was convert into image.
Globals.ThisAddIn.Application.ActiveDocument.Select();...
|
by: TSSRALBI |
last post by:
Hello
I'm a network technician in training and I need your help.
I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs.
The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols.
I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
| |
by: adsilva |
last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
| |