0

私は次のコードを使用しています:

SqlDataSource1.InsertCommand = "insert into tblCaller with (ROWLOCK) (CallerID,Name,Surname,Home_Tel,Work_Tel,Cellphone,Relation_Type,Relationship) values ('" & txtEnqNo.Text & "','" & txtName.Text & "','" & txtSurname.Text & "','" & txtHome.Text & " ','" & txtWork.Text & "','" & txtCell.Text & " ','" & RTypeDropDownList.SelectedValue & "','" & txtRelationshp.Text & "')"
SqlDataSource1.Insert()

SqlDataSource2.InsertCommand = "insert into tblBeneficiary with (ROWLOCK) (Ben_ID,CallerID,Name,Surname,Contact_No,Res_Address) values ('" & txtBenID.Text & "','" & txtEnqNo.Text & "','" & txtBenName.Text & " ','" & txtBenSurname.Text & "','" & txtContNo.Text & "','" & DropDownList17.SelectedValue & "')"
SqlDataSource2.Insert()

SqlDataSource3.InsertCommand = "insert into tblIncident with (ROWLOCK) (Incident_No,CallerID,Reg_Code,District,Local_Office,Municipality,Ward,Access_Type,Enquiry_Type,Grant_Type,Summary,Detailed,Priority,Log_Date,Status,Resolution,Resol_Date,Capturer,Assigned_To) values ('" & txtIncident.Text & "','" & txtEnqNo.Text & "','" & lblRegion.Text & " ','" & DropDownList5.SelectedItem.Text & "','" & DropDownList6.SelectedItem.Text & " ','" & txtMunicipal.Text & " ','" & txtWard.Text & "','" & AccessRadioButtonList.SelectedValue & "', '" & EnquiryRadioButtonList.SelectedValue & "','" & GrantRadioButtonList.SelectedValue & "','" & DropDownList1.SelectedValue & "','" & txtDetailed.Text & "','" & PriorityRadioButtonList.SelectedValue & "','" & txtDlog.Text & "','" & DropDownList16.SelectedValue & "',' " & txtResolution.Text & "','" & txtDResol.Text & "','" & GridView4.Rows(0).Cells(0).Text & "','" & DropDownList15.SelectedValue & "')"
SqlDataSource3.Insert()

SqlDataSource4.InsertCommand = "insert into tblHistory with (ROWLOCK) (Incident_No,Status,Resolution,Last_updated,Log_date,Capturer,Assigned_to,Updater) values ('" & txtIncident.Text & "','" & DropDownList1.SelectedValue & "','" & txtResolution.Text & "','" & txtDlog.Text & "','" & txtDlog.Text & "','" & GridView4.Rows(0).Cells(0).Text & "','" & DropDownList15.SelectedValue & "','" & GridView4.Rows(0).Cells(0).Text & "')"
SqlDataSource4.Insert()
4

1 に答える 1

0

4 つの独立したストアド プロシージャを記述し、ボタン クリック コード ビハインドで呼び出します。

if(first stored procedure()>0)
   {
    if(second procedure()>0)
      {
        if(..)
         {
           ....
          }
      }
   }

適切な try catch メソッドを使用してください。

于 2013-03-25T09:50:07.427 に答える