Idodontnet
New member
- Joined
- Aug 19, 2010
- Messages
- 4
- Location
- San Jose, California, United States
- Programming Experience
- 1-3
Hello,
I’m have one heard time trying to get data back from a SP on my SQL server...
Here is what I have from looking all over the net to get it working...
Dim conn = New SqlConnection("Data Source=SQLsvr5;Initial Catalog=Orders;Persist Security Info=True;User ID=userx;Password=123123")
conn.Open()
Dim sqlcomm As New SqlCommand
sqlcomm.Connection = conn
sqlcomm.CommandType = CommandType.StoredProcedure
sqlcomm.CommandText = "sp_Get_itemName"
sqlcomm.Parameters.Add("@ItemID", SqlDbType.Int)
sqlcomm.Parameters("@ItemID").Value = "5"
sqlcomm.Parameters.Add("@Name", SqlDbType.NVarChar, 100)
sqlcomm.Parameters("@Name").Direction = ParameterDirection.Output
sqlcomm.ExecuteNonQuery()
TextBox1.Text = sqlcomm.Parameters("@Name").Value.ToString
So this tries to Run a SP named "sp_Get_itemName"
- It sends the value of 5 for the Parameter of @ItemID
- I want to get back the field value for "Name"
- I get the ERROR:
“Procedure or function sp_Get_itemName has too many arguments specified.”
I know that the SP spits out 3 fields "ID", "Name" and "Description" when I run it from SQL server management studio
Any help would be appreciated, Thanks!
Shane
I’m have one heard time trying to get data back from a SP on my SQL server...
Here is what I have from looking all over the net to get it working...
Dim conn = New SqlConnection("Data Source=SQLsvr5;Initial Catalog=Orders;Persist Security Info=True;User ID=userx;Password=123123")
conn.Open()
Dim sqlcomm As New SqlCommand
sqlcomm.Connection = conn
sqlcomm.CommandType = CommandType.StoredProcedure
sqlcomm.CommandText = "sp_Get_itemName"
sqlcomm.Parameters.Add("@ItemID", SqlDbType.Int)
sqlcomm.Parameters("@ItemID").Value = "5"
sqlcomm.Parameters.Add("@Name", SqlDbType.NVarChar, 100)
sqlcomm.Parameters("@Name").Direction = ParameterDirection.Output
sqlcomm.ExecuteNonQuery()
TextBox1.Text = sqlcomm.Parameters("@Name").Value.ToString
So this tries to Run a SP named "sp_Get_itemName"
- It sends the value of 5 for the Parameter of @ItemID
- I want to get back the field value for "Name"
- I get the ERROR:
“Procedure or function sp_Get_itemName has too many arguments specified.”
I know that the SP spits out 3 fields "ID", "Name" and "Description" when I run it from SQL server management studio
Any help would be appreciated, Thanks!
Shane