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

Adding parameters to stored procedures

P: n/a
Thanx to the help of other memebers on this group i've gotten to where
I am

however, I seem unable to add the required paramater to my stored
procedure

my code

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID",
"VINET")
Me.SqlSelectCommand1.ExecuteNonQuery()
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelectC ommand1.CommandText,
Me.SqlConnection1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn
the error

Procedure 'CustOrdersOrders' expects parameter '@CustomerID', which was
not supplied
any help?

thanx in advance

Sep 12 '06 #1
Share this Question
Share on Google+
3 Replies


P: n/a
Bonzol,

You try modifying your code like this:

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID", "VINET")
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelectC ommand1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn

Kerry Moorman
"Bonzol" wrote:
Thanx to the help of other memebers on this group i've gotten to where
I am

however, I seem unable to add the required paramater to my stored
procedure

my code

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID",
"VINET")
Me.SqlSelectCommand1.ExecuteNonQuery()
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelectC ommand1.CommandText,
Me.SqlConnection1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn
the error

Procedure 'CustOrdersOrders' expects parameter '@CustomerID', which was
not supplied
any help?

thanx in advance

Sep 12 '06 #2

P: n/a
Cheers
Kerry Moorman wrote:
Bonzol,

You try modifying your code like this:

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID", "VINET")
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelectC ommand1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn

Kerry Moorman
"Bonzol" wrote:
Thanx to the help of other memebers on this group i've gotten to where
I am

however, I seem unable to add the required paramater to my stored
procedure

my code

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID",
"VINET")
Me.SqlSelectCommand1.ExecuteNonQuery()
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelectC ommand1.CommandText,
Me.SqlConnection1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn
the error

Procedure 'CustOrdersOrders' expects parameter '@CustomerID', which was
not supplied
any help?

thanx in advance
Sep 13 '06 #3

P: n/a
Bonzol,

Be aware that the sample as Kerry gave you is only working after evertime
initializing the command.
If you using the parameter more than you have only to set the value of the
command

Me.SqlSelectCommand1.Parameters("@CustomerId").Val ue = "BINET"

Just as addition

Cor
"Bonzol" <Bo****@hotmail.comschreef in bericht
news:11*********************@h48g2000cwc.googlegro ups.com...
Cheers
Kerry Moorman wrote:
>Bonzol,

You try modifying your code like this:

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID",
"VINET")
Me.SqlSelectCommand1.Connection = Me.SqlConnection1
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelect Command1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn

Kerry Moorman
"Bonzol" wrote:
Thanx to the help of other memebers on this group i've gotten to where
I am

however, I seem unable to add the required paramater to my stored
procedure

my code

Dim toreturn As System.Data.DataTable
' Try
Me.SqlConnection1.Open()
Me.SqlSelectCommand1.CommandText = "[CustOrdersOrders]"
Me.SqlSelectCommand1.Parameters.AddWithValue("@Cus tomerID",
"VINET")
Me.SqlSelectCommand1.ExecuteNonQuery()
Me.SqlDataAdapter1 = New
System.Data.SqlClient.SqlDataAdapter(Me.SqlSelectC ommand1.CommandText,
Me.SqlConnection1)
Dim dt As System.Data.DataTable
dt = New System.Data.DataTable
Me.SqlDataAdapter1.Fill(dt)

Me.SqlConnection1.Close()
toreturn = dt
'Catch

'End Try
Return toreturn
the error

Procedure 'CustOrdersOrders' expects parameter '@CustomerID', which was
not supplied
any help?

thanx in advance


Sep 13 '06 #4

This discussion thread is closed

Replies have been disabled for this discussion.