May 18, 2009 at 10:29 am
Well I have a Listings page (Listing-Details.aspx) and on that page is a function that pulls select information about what the user wants to buy.
Here is the current queries / stored procedures.
Stored Procedure: GetBuyingIDFromLoginID
USE [OHT]
GO
/****** Object: StoredProcedure [dbo].[GetBuyingIDFromLoginID] Script Date: 05/18/2009 11:08:48 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetBuyingIDFromLoginID]
@prmLoginId varchar(100)
AS
BEGIN
select buyingItem_id,city,[State],within_miles from buying_item where member_id=
(select member_id from Member where login_id = @prmLoginId)
END
which just selects the stuff
Stored Procedure:
USE [OHT]
GO
/****** Object: StoredProcedure [dbo].[GetLookingFor] Script Date: 05/18/2009 11:09:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetLookingFor]
@prmBuyItemID int
AS
BEGIN
select hf.* from buyingitem_feature bf inner join
house_feature hf on bf.feature_id = hf.feature_id
where bf.buyingItem_id=@prmBuyItemID
END
which inner join's info
but what the previous programmer didnt do was make it Listing ID specific. Example: lets say there is a listing_id 11111 and someone goes to that listing page, what I want the query to do is pull information for the listing 11111 and display it onto the page so it has to get the Listing_Id and put that into the query somehow as a WHERE statement or something and this is where I am lost.
(the code for displaying it on the page is complete, just need some help with the query)
Thanks
May 19, 2009 at 10:48 am
Maybe you could just add it as another parameter in one of your stored procedures?
USE [OHT]
GO
/****** Object: StoredProcedure [dbo].[GetLookingFor] Script Date: 05/18/2009 11:09:30 ******/
SET ANSI_NULLS ON
GO
SET QUOTED_IDENTIFIER ON
GO
ALTER PROCEDURE [dbo].[GetLookingFor]
@prmBuyItemID int,
@listingID int
AS
BEGIN
select hf.* from buyingitem_feature bf inner join
house_feature hf on bf.feature_id = hf.feature_id
where bf.buyingItem_id=@prmBuyItemID
and bf/hg.listing_id = @listingID
END
Greg
_________________________________________________________________________________________________
The glass is at one half capacity: nothing more, nothing less.
Viewing 2 posts - 1 through 2 (of 2 total)
You must be logged in to reply to this topic. Login to reply
This website stores cookies on your computer.
These cookies are used to improve your website experience and provide more personalized services to you, both on this website and through other media.
To find out more about the cookies we use, see our Privacy Policy