Anushart
asked on
Could not find the stored procedure
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_Resi stor").ToS tring 'From my app
carrierid = ds.Tables(1).Rows(0).Item( "CarrierNu mber").ToS tring()'Fr om my app
Dim SQLCon As New SqlClient.SqlConnection
SQLCon.ConnectionString = strConnection
da = New SqlDataAdapter("EXEC SP_DATAEVAL1 @carrierid, @plugres", SQLCon)
da.SelectCommand.CommandTy pe = CommandType.StoredProcedur e
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
plugres = ds.Tables(1).Rows(0).Item(
carrierid = ds.Tables(1).Rows(0).Item(
Dim SQLCon As New SqlClient.SqlConnection
SQLCon.ConnectionString = strConnection
da = New SqlDataAdapter("EXEC SP_DATAEVAL1 @carrierid, @plugres", SQLCon)
da.SelectCommand.CommandTy
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
Try this:
da = New SqlDataAdapter("SP_DATAEVA L1", SQLCon)
da.SelectCommand.CommandTy pe = CommandType.StoredProcedur e
da.SelectCommand.Parameter s.AddWithV alue("@car rierid", carrierid)
da.SelectCommand.Parameter s.AddWithV alue("@plu gres", plugres )
Bob
da = New SqlDataAdapter("SP_DATAEVA
da.SelectCommand.CommandTy
da.SelectCommand.Parameter
da.SelectCommand.Parameter
Bob
ASKER
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.CommandTy pe = CommandType.StoredProcedur e
da.SelectCommand.Parameter s.AddWithV alue("@car rierid", carrierid)
da.SelectCommand.Parameter s.AddWithV alue("@@pl ugresistor ", plugres)
Dim ds12 As New DataSet
SQLCon.Open()
da.Fill(ds12)
SQLCon.Close()
Can you tell me if I have coded anything wrong?
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.CommandTy
da.SelectCommand.Parameter
da.SelectCommand.Parameter
Dim ds12 As New DataSet
SQLCon.Open()
da.Fill(ds12)
SQLCon.Close()
Can you tell me if I have coded anything wrong?
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Thanks learnedone it worked!!
For example, if the strConnection opens a connection to database1, but sp_dataeval1 is in database2, then it will not find it.