Change stored proc to inline sql

前端 未结 2 953
闹比i
闹比i 2021-01-15 15:16

I have the following classic asp working, calling a stored proc in the database. I would like to convert it over so instead of calling the stored proc it passes in the sql,

2条回答
  •  傲寒
    傲寒 (楼主)
    2021-01-15 15:53

    To switch from a stored procedure to inline SQL, you need to change

    cmd.CommandType = adCmdStoredProc
    

    to

    cmd.CommandType = adCmdText
    

    Then you need to add the query to the command text property:

    cmd.CommandText = "SELECT * FROM Orders WHERE CustomerID = ?"
    

    The above line was derived from the Command Object Parameters example on MSDN.

提交回复
热议问题