简体   繁体   中英

Converting VB.NET code into a Stored procedure

I would like to convert the code below into a stored procedure. I cannot really work out how to do it. Could anyone point me in the right direction?

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

You can use a stored procedure like this

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 

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM