tailieunhanh - Executing a SQL Server Stored Procedure By Using ActiveX Data Objects

Thực hiện một SQL Server lưu trữ Thủ tục Bởi Sử dụng ActiveX Data Objects Nếu bạn đang làm một phát triển ADO với máy chủ của khách hàng đối với hậu phương, sau đó bạn có thể gọi thủ tục lưu trữ. | Executing a SQL Server Stored Procedure By Using ActiveX Data Objects If you are doing an ADO development with client server for backends then you probably call stored procedures. In doing so you will use the ADO Command object as well as the Parameter object if you are passing parameters. You will create a Command object and supply the command text which in this case will be the name of the stored procedure called CustOrdersHist. You can see the T-SQL for CustOrderHist in Listing . This stored procedure returns product names and the total quantity purchased of those products for a given customer. Listing Northwind SQL Server Database T-SQL for the Stored Procedure Called CustOrdersHist ALTER PROCEDURE CustOrderHist @CustomerID nchar 5 AS SELECT ProductName Total SUM Quantity FROM Products P Order Details OD Orders O Customers C WHERE @CustomerID AND AND AND _ GROUP BY ProductName You will then specify the type of Command object you are creating-in this case by using the type of . The next step is to create a parameter that the Command object will use. This parameter will match the one specified in CustOrdersHist called CustomerID. You can see the actual code for this routine called UseAStoredProcedureWithAParameter in Listing . Listing Calling a Stored Procedure By Using Parameters Sub UseAStoredProcedureWithAParameter ByVal txtResults As TextBox Dim cnn As New Dim rstCurr As New Dim cmd As New Dim prm As Try CustOrderHist prm CustomerID 5 prm CHOPS OpenNorthwindADOConnection cnn cnn cmd Catch

crossorigin="anonymous">
Đã phát hiện trình chặn quảng cáo AdBlock
Trang web này phụ thuộc vào doanh thu từ số lần hiển thị quảng cáo để tồn tại. Vui lòng tắt trình chặn quảng cáo của bạn hoặc tạm dừng tính năng chặn quảng cáo cho trang web này.