我想将下面的代码转换为存储过程。我真的无法弄清楚如何做到这一点。有人能指出我正确的方向吗?
If NextApproverType = "" Or NextApproverType = "V" Then
DBF.ExecuteNonQuery("Update JobOrders set Jo_Status='5' where jo_number='" & ViewState("Jonumber") & "'", , CommandType.Text)
End If
If Trim(ApproverType) = "JA" Then
If txtApproverComments.Text <> "" Then
DBF.ExecuteNonQuery("Update JONotes set AApproverNotes=IsNull(AApproverNotes,' ')+'" & vbCrLf & txtApproverComments.Text & vbCrLf & "--" & DBF.ExecuteScalar("select lastname +', '+ firstname +' '+ isnull(middlename,'') from menu_user where userid='" & Session("userid") & "'", , CommandType.Text) & "',ANoteEnterOn='" & Now.Date() & "' where Jo_number='" & ViewState("Jonumber") & "'", , CommandType.Text)
End If
答案 0 :(得分:1)
您可以使用像这样的存储过程
CREATE PROCEDURE My_Procedure
@ApproverType NVARCHAR(10) ,
@txtApproverComments NVARCHAR(50) = NULL ,
@jo_number NVARCHAR(50)
AS
IF @ApproverType = 'ja'
BEGIN
IF @txtApproverComments IS NULL
BEGIN UPDATE JobOrders SET Jo_Status = '5' WHERE jo_number = @jo_number
END
END