|
web
newsgroups
|
|||||||||||||||||||||||
|
|||||||||||||||||||||||
SQL connectionI am trying to run a stored procedure but I get the following error: Could not find stored procedure. I know it is there so what am I doing wrong? Thank you in advance. My code is as follows: Dim cn As SqlClient.SqlConnection Dim cmd As SqlClient.SqlCommand cn = New SqlClient.SqlConnection("Server=******; Database=*****; uid=****; pwd=******") cn.Open() If cn.State = ConnectionState.Open Then cmd = New SqlClient.SqlCommand("CreelScheduleInfo1") cmd.Connection = cn cmd.CommandType = CommandType.StoredProcedure Dim p As New SqlClient.SqlParameter("@LakeCode", SqlDbType.VarChar, 50, "115") p.Value = True cmd.Parameters.Add(p) cmd.ExecuteNonQuery() cn.Close() End If Is it a SQL server namespace issue...? Is your procedure created in a
namespace other than the dbo namespace, if so specify it as such in your command constructor("myuser.stored_proc")... You should always qualify the namespace even if it is dbo. Show quoteHide quote "Dan" wrote: > I have a quick connection from a newbie. > I am trying to run a stored procedure but I get the following error: > Could not find stored procedure. I know it is there so what am I doing > wrong? Thank you in advance. > My code is as follows: > Dim cn As SqlClient.SqlConnection > Dim cmd As SqlClient.SqlCommand > cn = New SqlClient.SqlConnection("Server=******; Database=*****; > uid=****; pwd=******") > cn.Open() > If cn.State = ConnectionState.Open Then > cmd = New SqlClient.SqlCommand("CreelScheduleInfo1") > cmd.Connection = cn > cmd.CommandType = CommandType.StoredProcedure > Dim p As New SqlClient.SqlParameter("@LakeCode", > SqlDbType.VarChar, 50, "115") > p.Value = True > cmd.Parameters.Add(p) > cmd.ExecuteNonQuery() > cn.Close() > End If Your suggestion seemed to help but another error has occurred. I know get a
"Could not connect to server 'GOFISH' because 'dstrick' is not defined as a remote login at the server." Thanks for your help. Dan Show quoteHide quote "Alien2_51" wrote: > Is it a SQL server namespace issue...? Is your procedure created in a > namespace other than the dbo namespace, if so specify it as such in your > command constructor("myuser.stored_proc")... You should always qualify the > namespace even if it is dbo. > > "Dan" wrote: > > > I have a quick connection from a newbie. > > I am trying to run a stored procedure but I get the following error: > > Could not find stored procedure. I know it is there so what am I doing > > wrong? Thank you in advance. > > My code is as follows: > > Dim cn As SqlClient.SqlConnection > > Dim cmd As SqlClient.SqlCommand > > cn = New SqlClient.SqlConnection("Server=******; Database=*****; > > uid=****; pwd=******") > > cn.Open() > > If cn.State = ConnectionState.Open Then > > cmd = New SqlClient.SqlCommand("CreelScheduleInfo1") > > cmd.Connection = cn > > cmd.CommandType = CommandType.StoredProcedure > > Dim p As New SqlClient.SqlParameter("@LakeCode", > > SqlDbType.VarChar, 50, "115") > > p.Value = True > > cmd.Parameters.Add(p) > > cmd.ExecuteNonQuery() > > cn.Close() > > End If Hi,
Open up the database in vs.net's server explorer and make the stored procedure exists. I would also make sure you have the parameter names correct. Ken ----------------------- "Dan" <D**@discussions.microsoft.com> wrote in message I have a quick connection from a newbie.news:D48A107A-3C9A-431A-96A1-5B0A370E619F@microsoft.com... I am trying to run a stored procedure but I get the following error: Could not find stored procedure. I know it is there so what am I doing wrong? Thank you in advance. My code is as follows: Dim cn As SqlClient.SqlConnection Dim cmd As SqlClient.SqlCommand cn = New SqlClient.SqlConnection("Server=******; Database=*****; uid=****; pwd=******") cn.Open() If cn.State = ConnectionState.Open Then cmd = New SqlClient.SqlCommand("CreelScheduleInfo1") cmd.Connection = cn cmd.CommandType = CommandType.StoredProcedure Dim p As New SqlClient.SqlParameter("@LakeCode", SqlDbType.VarChar, 50, "115") p.Value = True cmd.Parameters.Add(p) cmd.ExecuteNonQuery() cn.Close() End If
Make installer make app start up on login
Option Strict ON and Dictionary obect How do I shell the following command line or process.start it (very different command!) Oledb???? Destructor for VB.NET class With different credentials. two console apps. detect clicked column in datagrid Forms.captionbutton CreationTime and Windows File CreationTime why different? |
|||||||||||||||||||||||