Re: Pramererized Stored Proc returning error when run from vb.net code
From: Narayana Vyas Kondreddi (answer_me_at_hotmail.com)
Date: 07/09/04
- Next message: Narayana Vyas Kondreddi: "Re: How to monitor Triggers in VB6"
- Previous message: Mingqing Cheng [MSFT]: "RE: CPU usage"
- In reply to: Anand Sagar: "Pramererized Stored Proc returning error when run from vb.net code"
- Next in thread: Dan Guzman: "Re: Pramererized Stored Proc returning error when run from vb.net code"
- Messages sorted by: [ date ] [ thread ]
Date: Fri, 9 Jul 2004 08:27:31 +0100
Can you run Profiler on the server (trace SQL:BatchStarting, SP:Starting
events) to see what's actually coming into SQL Server, from your app.
That'll give you the clue.
-- Vyas, MVP (SQL Server) http://vyaskn.tripod.com/ "Anand Sagar" <ba_sagar@yahoo.com> wrote in message news:%23FoIPBYZEHA.1508@TK2MSFTNGP09.phx.gbl... > I created a stored procedure > > create proc getcontact @acno varchar(30) > as > select * from contact1 where accountno = @acno > > > When I execute this sp in the Query Analayser like this > > getcontact '95112933591388844Gab' > > it works. > > > > But when I try to execute from my asp.net code, > > Dim Con As New SqlConnection("server=.;uid=sa;pwd=;database=testgm") > Con.Open() > > Dim cmd As New SqlCommand("getcontact", Con) > cmd.Parameters.Add(New SqlParameter("@acno", "95112933591388844Gab")) > > Dim dr As SqlDataReader = cmd.ExecuteReader() > > at this point the program returns an error saying > > ***************************** > Line 1: Incorrect syntax near 'getcontact'. > Description: An unhandled exception occurred during the execution of the > current web request. Please review the stack trace for more information > about the error and where it originated in the code. > > Exception Details: System.Data.SqlClient.SqlException: Line 1: Incorrect > syntax near 'getcontact'. > > Source Error: > > > Line 108: > Line 109: > Line 110: Dim dr As SqlDataReader = cmd.ExecuteReader() > Line 111: 'Dim da As New SqlDataAdapter(cmd) > Line 112: > > > Source File: f:\GoldMine_Net\Load_LeftblankCombo.aspx.vb Line: 110 > > ***************************************** > > Why does it say Incorrect syntax near 'getcontact'. when the same proc is > succesful run from Query Analyser tool ? > > Please help > > Thanks, > Anand Sagar. > >
- Next message: Narayana Vyas Kondreddi: "Re: How to monitor Triggers in VB6"
- Previous message: Mingqing Cheng [MSFT]: "RE: CPU usage"
- In reply to: Anand Sagar: "Pramererized Stored Proc returning error when run from vb.net code"
- Next in thread: Dan Guzman: "Re: Pramererized Stored Proc returning error when run from vb.net code"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|