W
wk6pack
Hi,
I'm trying to pass only the required parameters to a stored procedure using
the following code. I keep getting the following error now.
Running dbo."InsertEmployee" ( @pemployeeno = "888888", @S_I_N =
"123456789", @pfirstname = "Sam", @plastname = "Wise", @pmiddlename =
<DEFAULT>, @pprimaryemail = "(e-mail address removed)", @psecondaryemail =
<DEFAULT>, @status_code = "A" ).
---> Error converting data type varchar to numeric. <------
Dim SIMSSqlcommand As New SqlCommand
SIMSSqlcommand.Connection = connection
SIMSSqlcommand.CommandText = "InsertEmployee"
SIMSSqlcommand.CommandType = CommandType.StoredProcedure
SIMSSqlcommand.namedparameter = True
SIMSSqlcommand.Parameters.Add("@CustomerID", "PAULK")
SIMSSqlcommand.Parameters.Add("@CompanyName", "Pauly's Bar")
STORED PROCEDURE
CREATE PROCEDURE dbo.InsertEmployee
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
(
@pemployeeno char(10),
@S_I_N nvarchar(10),
@pfirstname nvarchar(50),
@plastname nvarchar(50),
@pmiddlename nvarchar(50)=" ",
@pprimaryemail nvarchar(50)=" ",
@psecondaryemail nvarchar(50) = " ",
@status_code char(10) = " "
)
AS
declare @pstatusid numeric
/* SET NOCOUNT ON */
select @pstatusid = statusid
from status
where statuscode = @status_code;
insert into Employee
(
Employeeno,
S_I_N,
firstname,
lastname,
middlename,
primaryemail,
secondaryemail,
statusid
)
values
(
@pemployeeno,
@S_I_N,
@pfirstname,
@plastname,
@pmiddlename,
@pprimaryemail,
@psecondaryemail,
@status_code
)
select @@identity
RETURN
GO
thanks,
Will
I'm trying to pass only the required parameters to a stored procedure using
the following code. I keep getting the following error now.
Running dbo."InsertEmployee" ( @pemployeeno = "888888", @S_I_N =
"123456789", @pfirstname = "Sam", @plastname = "Wise", @pmiddlename =
<DEFAULT>, @pprimaryemail = "(e-mail address removed)", @psecondaryemail =
<DEFAULT>, @status_code = "A" ).
---> Error converting data type varchar to numeric. <------
Dim SIMSSqlcommand As New SqlCommand
SIMSSqlcommand.Connection = connection
SIMSSqlcommand.CommandText = "InsertEmployee"
SIMSSqlcommand.CommandType = CommandType.StoredProcedure
SIMSSqlcommand.namedparameter = True
SIMSSqlcommand.Parameters.Add("@CustomerID", "PAULK")
SIMSSqlcommand.Parameters.Add("@CompanyName", "Pauly's Bar")
STORED PROCEDURE
CREATE PROCEDURE dbo.InsertEmployee
/*
(
@parameter1 datatype = default value,
@parameter2 datatype OUTPUT
)
*/
(
@pemployeeno char(10),
@S_I_N nvarchar(10),
@pfirstname nvarchar(50),
@plastname nvarchar(50),
@pmiddlename nvarchar(50)=" ",
@pprimaryemail nvarchar(50)=" ",
@psecondaryemail nvarchar(50) = " ",
@status_code char(10) = " "
)
AS
declare @pstatusid numeric
/* SET NOCOUNT ON */
select @pstatusid = statusid
from status
where statuscode = @status_code;
insert into Employee
(
Employeeno,
S_I_N,
firstname,
lastname,
middlename,
primaryemail,
secondaryemail,
statusid
)
values
(
@pemployeeno,
@S_I_N,
@pfirstname,
@plastname,
@pmiddlename,
@pprimaryemail,
@psecondaryemail,
@status_code
)
select @@identity
RETURN
GO
thanks,
Will