I created a stored procedure - code to follow - I can exec the procedure from within the sql management studio and it works. I'm trying to call to fill a bo - that code also below. I get an error saying the stored procedure expects a parameter
'@startdate' - which I think I'm supplying - Looking for help as to where I've gone wrong.
SQL Stored Procedure:
SET
ANSI_NULLS ONGO
SET
QUOTED_IDENTIFIER ONGO
-- =============================================
-- Author: MRP
-- Create date: 10/2009
-- Description: return table needed for pay error report
-- =============================================
ALTER
PROCEDURE [dbo].[sdsi_ExtractPayrollErrors]-- Add the parameters for the stored procedure here
@startdate
datetime, @enddate
datetime AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from-- interfering with SELECT statements.SET NOCOUNT ON;-- Insert statements for procedure hereselect pd.*,co.companies_name from payrolldata PDleft join companies co on co.companies_pk = pd.pay_hiringco,(select pay_hiringco,pay_ssn,max(pay_paydate) as lastpay,max(pay_pk) as paypk from payrolldata where pay_paydate > = @startdate and pay_paydate <= @enddate group by pay_hiringco, pay_ssn) PSwhere pd.pay_pk = ps.paypkorder by companies_name,pay_fullnameEND
VB code to fillbystoredprocedure:
'-- Create a new parameter that matches the stored procedure
Dim loParm1 As SqlParameter
loParm1 = New SqlParameter()
loParm1.ParameterName = "@startdate"
loParm1.DbType = DbType.DateTime
loParm1.Direction = ParameterDirection.Input
loParm1.Value = rptstartdt
'-- Create a new parameter that matches the stored procedure
Dim loParm2 As SqlParameter
loParm2 = New SqlParameter()
loParm2.ParameterName = "@enddate"
loParm2.DbType = DbType.DateTime
loParm2.Direction = ParameterDirection.Input
loParm2.Value = rptenddt
'-- Fill the business object by calling the stored procedure
Me.PayrollBORPT.FillByStoredProcedure("sdsi_ExtractPayrollErrors", loParm1, loParm2)