With g_adoCmd
.CommandText = "EMailProspectiveResidentInformation"
.CommandType = adCmdStoredProc
.Parameters.Refresh
.Parameters("@lID") = Me!pkID ' input value
Set rs = .Execute 'retrieve the recordset
strError = .Parameters("@Error")
End With
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
-- =============================================
-- Description:
-- =============================================
ALTER PROCEDURE [dbo].[EMailProspectiveResidentInformation](
@lID INT,
@Error varchar(128) Output )
AS
BEGIN
-- SET NOCOUNT ON added to prevent extra result sets from
-- interfering with SELECT statements.
SET NOCOUNT ON;
Set @Error = ''
if ( Select COUNT(*) from tblProspectiveResidents where CallID = @lID) = 0
Begin
SET @Error = 'Invalid CallID for tblStates in EMailProspectiveResidentInformation'
End
Else
Begin
SELECT AT.Description as ApartmentType
, FL.Description as FloorLevel
, TL.Description as Location
, PP.DateNeeded
, PP.NumberOfOccupants
, PT.Description as PetType
, PP.PetWeight
, PP.PriceRange
, PP.ReasonForMoving
, PP.Employer
, PP.EmployerPhoneNumber
, TS.TrafficSourceName
, PP.LeadType
, PP.Appointment
, PP.Other
FROM tblProspectiveResidents PP
INNER JOIN tblApartmentType AT ON PP.ApartmentTypeID = AT.pkID
INNER JOIN tblFloorLevel FL ON PP.FloorLevelID = FL.pkID
INNER JOIN tblLocation TL ON PP.LocationID = TL.pkID
INNER JOIN tblPetType PT ON PP.PetTypeID = PT.pkID
INNER JOIN tblTrafficSources TS ON PP.TrafficSourceID = TS.pkID
WHERE PP.CallID = @lID
End
END
|