i have this code in my btnsave..it can detect conflicts but after that a dialog box saying:
An unhandled exception of type 'System.NullReferenceException' occurred in AppointmentSchedulingClient.exe
Additional information: Object reference not set to an instance of an object.
and it points to the green one below.
If Val(cbostart.Text) > Val(cboend.Text) Or Val(cbostart.Text) = Val(cboend.Text) Then MsgBox("Error in time.", MsgBoxStyle.Information, "MESSAGE") Else open_con2() sqlsearch = "Select *from tblappointreserv" cmd2 = New OleDbCommand(sqlsearch, con2) dr = cmd2.ExecuteReader While dr.Read Dim date, startime, endtime, d As String date = dtpdate.Text = dr("Whendate") startime = cbostart.Text = dr("Startime") endtime = cboend.Text = dr("Endtime") d = startime = True And endtime = True If d = True And date = True Then MsgBox( "Sorry your appointment can't be reserve. Conflict has been detected.", MsgBoxStyle.Information, "MESSAGE") End If dr.Close() dr = Nothing End While End If
i still have the SQlInsert below that.. but this thing sucks me.. please help me..