WritePageToDB

From FeMR Wiki
Jump to navigation Jump to search

This function writes data entered on an ASP page into the database which is displayed later in view or print modes.

For now this page will focus on how to write to more than one table from the same page.

In the Dim declaration, add these three lines:

       Dim strSQL4 As String
       Dim strSQL5 As String
       Dim strSQL6 As String

After the last strSQL2 IF statement, add the lines for strings 4, 5, and 6 and be sure to the table intended is updated in string 4:

           strSQL4 = " update tblPatientMaster"
           strSQL6 = " where varMedicalRecordNumber='" & Session("sesCurrentMedicalRecordNumber") & "'"
           strSQL5 = "  SET " & _

Next add a second cmdAdd parameter statement:

       Dim cmdAdd1 As New SqlCommand(strSQL4 & strSQL5 & strSQL6, con)
       With cmdAdd1.Parameters

       End With

Finally, execute the write command with the second set of parameters:

       strErrLocation = "DB Write"
       cmdAdd.ExecuteNonQuery()
       cmdAdd1.ExecuteNonQuery()