Hi all,
I am getting an error patientid as not declared
Dim strstatus As String = drAccessionNumbers.Item(1).ToString()
If (DirectCast(drAccessionNumbers("status"), String) <> "Provisional") AndAlso (DirectCast(drAccessionNumbers("status"), String) <> "Completed") Then
sql = "UPDATE ExamRecord SET Status='Cancelled' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
sql2 = "UPDATE AdditionalExamRecord SET Ordered ='0',CancelledOn='" & String.Format("{0:d}", Today) & "', CancelledBy='" & sUserID & "' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
End If
here if I am using the below code I am not getting the error
Dim strstatus As String = drAccessionNumbers.Item(1).ToString()
If (DirectCast(drAccessionNumbers("status"), String) <> "Provisional") Then
sql = "UPDATE ExamRecord SET Status='Cancelled' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
sql2 = "UPDATE AdditionalExamRecord SET Ordered ='0',CancelledOn='" & String.Format("{0:d}", Today) & "', CancelledBy='" & sUserID & "' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
End If
Entire code
Public Function UpdateAllStatusesSQL(ByVal statusAbbr As String, _ ByVal patientId As String, _
ByVal scheduleDate As String, Optional ByVal sUserID As String = "") As Integer
'--- Variables
Try
cmd.Connection = New SqlConnection(ConnString)
cmd.Connection.Open()
'--- First get all accession numbers associated with this patient id
sql = "SELECT AccessionNumber,status FROM ExamRecord WHERE PatientID = @PatientID "
sql += "AND ScheduleDate = @ScheduleDate AND Status <> 'Cancelled'"
cmd.CommandText = sql
da.SelectCommand = cmd
da.SelectCommand.Parameters.Add("@PatientID", SqlDbType.NChar).Value = patientIdda.SelectCommand.Parameters.Add("@ScheduleDate", SqlDbType.DateTime).Value = scheduleDate
drAccessionNumbers = da.SelectCommand.ExecuteReader(CommandBehavior.CloseConnection)
Dim dhSql As New SQLDataHandler
While drAccessionNumbers.Read()cmd2.Connection = New SqlConnection(ConnString)
cmd2.Connection.Open()
Select Case statusAbbr.ToUpper()
Case "C"
Dim strstatus As String = drAccessionNumbers.Item(1).ToString()
If (DirectCast(drAccessionNumbers("status"), String) <> "Provisional") AndAlso (DirectCast(drAccessionNumbers("status"), String) <> "Completed") Then
sql = "UPDATE ExamRecord SET Status='Cancelled' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
sql2 = "UPDATE AdditionalExamRecord SET Ordered ='0',CancelledOn='" & String.Format("{0:d}", Today) & "', CancelledBy='" & sUserID & "' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
End If
End Select
Thanks for any help in advance..
I am getting an error patientid as not declared
Dim strstatus As String = drAccessionNumbers.Item(1).ToString()
If (DirectCast(drAccessionNumbers("status"), String) <> "Provisional") AndAlso (DirectCast(drAccessionNumbers("status"), String) <> "Completed") Then
sql = "UPDATE ExamRecord SET Status='Cancelled' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
sql2 = "UPDATE AdditionalExamRecord SET Ordered ='0',CancelledOn='" & String.Format("{0:d}", Today) & "', CancelledBy='" & sUserID & "' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
End If
here if I am using the below code I am not getting the error
Dim strstatus As String = drAccessionNumbers.Item(1).ToString()
If (DirectCast(drAccessionNumbers("status"), String) <> "Provisional") Then
sql = "UPDATE ExamRecord SET Status='Cancelled' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
sql2 = "UPDATE AdditionalExamRecord SET Ordered ='0',CancelledOn='" & String.Format("{0:d}", Today) & "', CancelledBy='" & sUserID & "' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
End If
Entire code
Public Function UpdateAllStatusesSQL(ByVal statusAbbr As String, _ ByVal patientId As String, _
ByVal scheduleDate As String, Optional ByVal sUserID As String = "") As Integer
'--- Variables
Try
cmd.Connection = New SqlConnection(ConnString)
cmd.Connection.Open()
'--- First get all accession numbers associated with this patient id
sql = "SELECT AccessionNumber,status FROM ExamRecord WHERE PatientID = @PatientID "
sql += "AND ScheduleDate = @ScheduleDate AND Status <> 'Cancelled'"
cmd.CommandText = sql
da.SelectCommand = cmd
da.SelectCommand.Parameters.Add("@PatientID", SqlDbType.NChar).Value = patientIdda.SelectCommand.Parameters.Add("@ScheduleDate", SqlDbType.DateTime).Value = scheduleDate
drAccessionNumbers = da.SelectCommand.ExecuteReader(CommandBehavior.CloseConnection)
Dim dhSql As New SQLDataHandler
While drAccessionNumbers.Read()cmd2.Connection = New SqlConnection(ConnString)
cmd2.Connection.Open()
Select Case statusAbbr.ToUpper()
Case "C"
Dim strstatus As String = drAccessionNumbers.Item(1).ToString()
If (DirectCast(drAccessionNumbers("status"), String) <> "Provisional") AndAlso (DirectCast(drAccessionNumbers("status"), String) <> "Completed") Then
sql = "UPDATE ExamRecord SET Status='Cancelled' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
sql2 = "UPDATE AdditionalExamRecord SET Ordered ='0',CancelledOn='" & String.Format("{0:d}", Today) & "', CancelledBy='" & sUserID & "' WHERE AccessionNumber = " & drAccessionNumbers.Item(0)
End If
End Select
Thanks for any help in advance..