View Single Post
  #4 (permalink)  
Old April 10th, 2010, 03:37 PM
dparsons dparsons is offline
Wrox Author
Points: 13,255, Level: 49
Points: 13,255, Level: 49 Points: 13,255, Level: 49 Points: 13,255, Level: 49
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Oct 2005
Location: Ohio, USA
Posts: 4,104
Thanks: 1
Thanked 64 Times in 64 Posts
Send a message via AIM to dparsons
Default

Yes, it does exist, in the second table of your dataset. See what happens is that when you do this:

vb Code:
GridView1.DataSource = dataset
GridView1.DataBind()

Your GridView is being bound to the first table in your dataset however the ByersAgent column is in the SECOND table of your dataset. Now the reason you have two tables in your dataset is because your sproc is doing two select statements and therefore returning two resultsets.

I think the easiest solution here would be to modify your SQL statement to be something like this:

sql Code:
SELECT
d.DealID,
d.DealName,
d.StartDate,
d.ContractDate,
d.ClosingDate,
d.DealShortName,
o.SubmitRole,
o.STATUS,
o.OfferNumber,
o.OfferType,
o.OfferDateTime,
o.PctDown,
o.OfferAmount,
o.SuggestedClosingDate,
o.CompletePct,
o.Guarantor,
o.Contingencies,
o.Notes,
o.mostrecent,
o.OfferID,
pt.StreetAddress1,
pt.StreetAddress2,
pt.City,
pt.State,
pt.Country,
pt.PostalCode,
p.FName + ' ' + p.LName AS [Purchaser1],
p2.FName + ' ' + p2.LName AS [BuyersAgent]
FROM tblDeal d
INNER JOIN tblOffer o ON d.DealID = o.DealKey
INNER JOIN tblPerson p ON p.PersonID = o.Purchaser1PersonKey
INNER JOIN tblPerson p2 ON p2.PersonID = o.BuyersAgentPersonKey
INNER JOIN tblProperty pt ON d.PropertyKey = pt.PropertyID
WHERE (d.DealID = @dealid)

This will return a single result and, therefore, one table of data.

hth
-Doug
__________________
===============================================
Doug Parsons
Wrox online library: Wrox Books 24 x 7
Did someone here help you? Click on their post!
"Easy is the path to wisdom for those not blinded by themselves."
===============================================