fillbystoredprocedure with multiple parameters


Author
Message
Michael R Poirier
Michael R Poirier
StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)StrataFrame Beginner (11 reputation)
Group: StrataFrame Users
Posts: 9, Visits: 131
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 ON

GO

SET QUOTED_IDENTIFIER ON

GO

-- =============================================

-- 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 here

select pd.*,co.companies_name from payrolldata PD

left 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) PS

where pd.pay_pk = ps.paypk

order by companies_name,pay_fullname

END

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)

GO

Merge Selected

Merge into selected topic...



Merge into merge target...



Merge into a specific topic ID...





Similar Topics

Reading This Topic

Login

Explore
Messages
Mentions
Search