We help IT Professionals succeed at work.

Could not find the stored procedure

350 Views
Last Modified: 2010-03-19
Could not find stored procedure 'EXEC SP_DATAEVAL1 @carrierid, @plugres'." blow is the code I wote the code
        plugres = ds.Tables(1).Rows(0).Item("Plug_Resistor").ToString 'From my app
        carrierid = ds.Tables(1).Rows(0).Item("CarrierNumber").ToString()'From my app
        Dim SQLCon As New SqlClient.SqlConnection
        SQLCon.ConnectionString = strConnection
        da = New SqlDataAdapter("EXEC SP_DATAEVAL1 @carrierid, @plugres", SQLCon)
        da.SelectCommand.CommandType = CommandType.StoredProcedure

        Dim ds1 As New DataSet
        SQLCon.Open()
        da.Fill(ds1)
        SQLCon.Close()
....................................................

SP_DATAEVAL1 is my stored procedure  @carrierid, @plugres are my parameters ...please check my code & tell me if i passed them correctly & why this error cannot find stored procedure is..
Thank you
Comment
Watch Question

Commented:
Is the sp_dataeval1 procedure in the same database as the strConnection database catalog?

For example, if the strConnection opens a connection to database1, but sp_dataeval1 is in database2, then it will not find it.
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008

Commented:
Try this:

da = New SqlDataAdapter("SP_DATAEVAL1", SQLCon)
da.SelectCommand.CommandType = CommandType.StoredProcedure
da.SelectCommand.Parameters.AddWithValue("@carrierid", carrierid)
da.SelectCommand.Parameters.AddWithValue("@plugres", plugres )

Bob

Author

Commented:
I checked the connection string and its correct(to database where my SP is there)
I even changed my SP name and tried this code but it still says cannot find Stored procedure

 Dim SQLCon As New SqlClient.SqlConnection
        SQLCon.ConnectionString = strConnection
        da = New SqlDataAdapter("EXEC DATAEVAL1_YESP", SQLCon)
        da.SelectCommand.CommandType = CommandType.StoredProcedure
        da.SelectCommand.Parameters.AddWithValue("@carrierid", carrierid)
        da.SelectCommand.Parameters.AddWithValue("@@plugresistor", plugres)
        Dim ds12 As New DataSet
        SQLCon.Open()
        da.Fill(ds12)
        SQLCon.Close()
Can you tell me if I have coded anything wrong?
CERTIFIED EXPERT
Most Valuable Expert 2012
Top Expert 2008
Commented:
Unlock this solution and get a sample of our free trial.
(No credit card required)
UNLOCK SOLUTION

Author

Commented:
Thanks learnedone it worked!!

Gain unlimited access to on-demand training courses with an Experts Exchange subscription.

Get Access
Why Experts Exchange?

Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.

Jim Murphy
Programmer at Smart IT Solutions

When asked, what has been your best career decision?

Deciding to stick with EE.

Mohamed Asif
Technical Department Head

Being involved with EE helped me to grow personally and professionally.

Carl Webster
CTP, Sr Infrastructure Consultant
Empower Your Career
Did You Know?

We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE

Ask ANY Question

Connect with Certified Experts to gain insight and support on specific technology challenges including:

  • Troubleshooting
  • Research
  • Professional Opinions
Unlock the solution to this question.
Thanks for using Experts Exchange.

Please provide your email to receive a sample view!

*This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

OR

Please enter a first name

Please enter a last name

8+ characters (letters, numbers, and a symbol)

By clicking, you agree to the Terms of Use and Privacy Policy.