SqlPipe 類
C# 復制代碼
[Microsoft.SqlServer.Server.SqlProcedure()]
public static void StoredProcExecuteCommand(int rating)
{
// Connect through the context connection.
using (SqlConnection connection = new SqlConnection("context connection=true"))
{
connection.Open();
SqlCommand command = new SqlCommand(
"SELECT VendorID, AccountNumber, Name FROM Purchasing.Vendor " +
"WHERE CreditRating <= @rating", connection);
command.Parameters.AddWithValue("@rating", rating);
// Execute the command and send the results directly to the client.
以上存儲過程的執行結果怎麼樣在ASP.NET2.0應用程序端來調用?
SqlContext.Pipe.ExecuteAndSend(command);
}
如果想把以上存儲過程的返回結果體現在DataList控件中,應用程序端的調用代碼是什麼樣的?