Call stored procedure in ASP.NET 2.0 - Inetserver
This is a discussion on Call stored procedure in ASP.NET 2.0 - Inetserver ; I 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'. ...
-
Call stored procedure in ASP.NET 2.0
I 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
-
Re: Call stored procedure in ASP.NET 2.0
Just found my answer in the post from Mark Rae. I was missing the value for
the CommandType.
Thanks!
Public Function GetCustomerOrderHistory(ByVal customerid As String) As
SqlDataReader
Dim conn As New SqlConnection(conString)
Dim cmd As New SqlCommand("CustOrderHist", conn)
cmd.CommandType = CommandType.StoredProcedure
cmd.Parameters.AddWithValue("@CustomerID", customerid)
conn.Open()
Dim dtr As SqlDataReader =
cmd.ExecuteReader(CommandBehavior.CloseConnection)
Return dtr
End Function
>I 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
>
-
Re: Call stored procedure in ASP.NET 2.0
"syoung" <saleyoun@hotmail.com> wrote in message
news:8bSdnWpx4KYpD6jeRVn-qg@comcast.com...
> Just found my answer in the post from Mark Rae. I was missing the value
> for the CommandType.
:-)
Now, any chance you can fix my problem...? ;-)
Similar Threads
-
By Application Development in forum ADO DAO RDO RDS
Replies: 8
Last Post: 08-26-2007, 04:08 PM
-
By Application Development in forum Java
Replies: 0
Last Post: 11-22-2006, 09:05 AM
-
By Application Development in forum Perl
Replies: 0
Last Post: 04-06-2006, 04:07 PM
-
By Application Development in forum ADO DAO RDO RDS
Replies: 0
Last Post: 10-14-2005, 09:53 AM
-
By Application Development in forum basic.visual
Replies: 1
Last Post: 06-18-2004, 03:05 PM