How to perform a stored procedure in the ASP? Choose Blog from Leonduan

xiaoxiao2021-03-06  17

1. What is a stored procedure? The stored procedure is a program written by the TRANACT-SQL language provided by SQL Server. 2. How to build a stored procedure? Create Procedure EmployeeID_Orders @ EmployeeID as intasselect * from orderswhere employeeID = @ EmployeeID3 ASP execute a stored procedure:. A write sql statement:. "Execute a stored procedure parameter name", then perform strSql by connection.execute or recordset.open = "execute employeeID_Orders 1 "set objRstOrders = objCnnNorthwind.Execute (strSql) B. through a command object type acCmdStoredProc command 'Create Object command set objCmdNorthwind = Server.CreateObject (" ADODB.Command ")' setting command text objCmdNorthwind.CommandText =" EmployeeID_OrDERS "'Set the type of command" ObjcmdnorthWind.commandtype = adcmdstoredProc' Set the connection object used by the command object set objcmdnorthWind.activeConnection = objcnnnorthwind

'Establish parameter object

Set objParam = objcmdnorthWind.createParameter ("@ EmployeeID", Adinteger, Adparaminput)

'Add the parameter object to the parameter set of command objects

ObjcmdnorthWind.Parameters.Append ObjParam

'Set the value of the parameter

ObjParam.Value = 2

'Execute the command object

Set objrstorders = objcmdnorthwind.execute ()

'Destroying ordered object

Set objcmdnorthwind = Nothing

转载请注明原文地址:https://www.9cbs.com/read-45173.html

New Post(0)