Link to home
Start Free TrialLog in
Avatar of FastEddie___
FastEddie___

asked on

Creating a Dataset from a Query

I'm trying to create a dataset with query that uses a dynamic field. Here is my sql:

=============================================================
SELECT a.cad_account_number, a.date_sold, a.county_name, a.sale_price,
           (a.sale_price - b.txroll_NoticedLandValue)/b.txroll_GBA AS imp,
            b.txroll_NeighborhoodCode, b.txroll_year, b.txroll_GBA, b.txroll_NoticedLandValue
FROM MLS a
INNER JOIN tbl_TaxRoll b
ON a.cad_account_number = b.txroll_CadAccountNumber
WHERE b.txroll_NeighborhoodCode IS NOT NULL AND b.txroll_GBA > 1 AND a.sale_price > 1
ORDER BY a.date_sold DESC, b.txroll_NeighborhoodCode
==============================================================

The second line creates a new field "imp" from calculations of other existing columns.

This sql works fine and I'm getting the needed results but I need to create a dataset that has all of these columns.

I'm using Visual Studio 2003 and MS SQL Server 2000. Is there any way of running this query and generating
a dataset from it? I just can't figure out how to use the visual studio IDE to generate a strongly typed dataset with multiple
tables that also has a dynamic column.

Any help is greatly appreciated.  
SOLUTION
Avatar of dungla
dungla
Flag of Viet Nam image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of FastEddie___
FastEddie___

ASKER

Hi Dungla,

Thanks for the code but I was wondering how to do that in the visual studio IDE.
I need to actually create the .xsd file so I can keep track of and modify the datasets in visual studio.
I create a dataset in the IDE by right clicking on the solution explorer and selecting Add New Item and
then selecting "Dataset". This works great if you are getting existing database fields but
I don't know how to add the dynamic field to the dataset through the IDE.

Got any ideas?

I appreciate your input.
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial