Home All Groups Group Topic Archive Search About
Author
4 Apr 2005 5:05 PM
Dan
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

Author
4 Apr 2005 5:43 PM
Alien2_51
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
Author
4 Apr 2005 9:35 PM
Dan
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
Author
4 Apr 2005 5:47 PM
Ken Tucker [MVP]
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
news:D48A107A-3C9A-431A-96A1-5B0A370E619F@microsoft.com...
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