Parameters are passed to Stored Procedure from VB.NET Application like
Dim param As SqlParameter
param = New SqlParameter("@name",DbType.String)
param.Direction = ParameterDirection.Input
param.Value = "ABC"
comand.Parameters.Add(param)
But is there any way to specify parameters without specifying the
parameter name and type like
Dim param As SqlParameter
param = New SqlParameter
param.Direction = ParameterDirection.Input
param.Value = "ABC"
comand.Parameters.Add(param)
But when i try like this i am getting an error saying that "Parameter1 is not a parameter in the procedure"...
I cannot make any changes in the Stored Procedure
Can anybody tell me how to solve this .
Thanx in advance
RakrusPosted Feb 20, 2008, 5:06 AM
Hi,
Dim param As SqlParameter
param = New SqlParameter
param.Direction = ParameterDirection.Input
param.Value = "ABC"
comand.Parameters.Add(param)
In the abovge code you have to mention the parameter name like this
param.ParameterName= "@name"
if you are passing a value means definitely it should gave a name.
if your procedure is not having any input parameters then dont add any parametrs to the sqlcommand,just mention the procedure name.
Thanks