Call stored procedure in ASP.NET 2.0
am 24.09.2005 19:48:18 von Sal YoungI would like to know if anyone knows how to execute a stored procedure from
ASP.NET 2.0. I'm using the NorthWind database and I'm trying to execute the
"CustOrderHist" stored procedure. The error I get is "Incorrect syntax
near 'CustOrderHist'. "
Public Function GetCustomerOrderHistory(ByVal customerid As String) As
SqlDataReader
Dim conn As New SqlConnection(conString)
Dim cmd As New SqlCommand("CustOrderHist", conn)
cmd.Parameters.AddWithValue("@CustomerID", customerid)
conn.Open()
Dim dtr As SqlDataReader =
cmd.ExecuteReader(CommandBehavior.CloseConnection)
Return dtr
End Function