By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
455,694 Members | 1,304 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 455,694 IT Pros & Developers. It's quick & easy.

SQL connection

P: n/a
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
Nov 21 '05 #1
Share this Question
Share on Google+
3 Replies


P: n/a
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

Nov 21 '05 #2

P: n/a
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" <Da*@discussions.microsoft.com> wrote in message
news:D4**********************************@microsof t.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
Nov 21 '05 #3

P: n/a
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

"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

Nov 21 '05 #4

This discussion thread is closed

Replies have been disabled for this discussion.