473,394 Members | 1,641 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,394 software developers and data experts.

Help with Datasets

I've been programming in C# for about 3 months now and I've completed a
previous project that worked a lot with data, so I know the basics.

This is what I need to do, try and see what you would do as an expert C#
programmer. I have to make a paired sales analysis which takes the same
home sold twice in a given time span and show how the price has changed to
show true market conditions.

Right now we have 120,000 rows of data that have basic home information like
so:

Table Name = Properties
Columns:
APN / Address / Bedrooms / Bathrooms / Selling Price / Zip Code / SQFT /
Selling Date / MLS Number

APN is unique to the property, but the MLS Number is unique to the database.
So if a house sells twice in the last year, it'll have two MLS Numbers, but
only one APN. I need to take all homes (APN's) that have sold more than
once (they appear twice in the database) and do some math and put it into a
GridView perhaps that looks like this:

Columns:
APN / Address / Date1 / Price$1 / Date2 / Price$2 / PriceChange$ /
TimeChange / ChangeOverTime

I need to take the address from the first entry in the database, then take
the date and price from the first entry, and the date and price from the
second entry, then do Price1 - Price2 and put that into PriceChange$, then
do the same for Date1 - Date2 for TimeChange, and finally do
(PriceChange/TimeChange) / Price1 and put that into ChangeOverTime. Then
there needs to be a column average for PriceChange$, TimeChange, and
ChangeOverTime, and they need to be loaded into variables that I can put
outside the gridview.

Alright, now I hope you might know why I came to the board for help. I'm
not really sure how to pull from different rows of a database and place them
into the same row of a table, gridview, etc.
--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com

Aug 13 '07 #1
4 1416
Hi,

You will have a hard time doing this in C#, when in SQL it's a pice of cake
:) , just a couple of grouping by clauses will solve your problem.

Can you put this data in a SQ:L DB?
Aug 13 '07 #2
Yeah I can make a second db to load them into, but I'm not sure what SQL
commands I would use to grab information from multiple rows and put them
into one row. I know I need to make a stored procedure that can manage the
math but after that I'm not really sure what to do.

--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP02.phx.gbl...
Hi,

You will have a hard time doing this in C#, when in SQL it's a pice of
cake :) , just a couple of grouping by clauses will solve your problem.

Can you put this data in a SQ:L DB?

Aug 13 '07 #3
Hi,

You use "group by" to create one row per one particular value.

Now, a question, what happen if a given house was sold more than two times?
"Luke Davis" <lu**@gorealco.comwrote in message
news:eh**************@TK2MSFTNGP05.phx.gbl...
Yeah I can make a second db to load them into, but I'm not sure what SQL
commands I would use to grab information from multiple rows and put them
into one row. I know I need to make a stored procedure that can manage
the math but after that I'm not really sure what to do.

--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com

"Ignacio Machin ( .NET/ C# MVP )" <machin TA laceupsolutions.comwrote in
message news:%2****************@TK2MSFTNGP02.phx.gbl...
>Hi,

You will have a hard time doing this in C#, when in SQL it's a pice of
cake :) , just a couple of grouping by clauses will solve your problem.

Can you put this data in a SQ:L DB?


Aug 13 '07 #4
Luke,
What you describe really sounds like a classic database normailization
issue. If you have a listing that could have 2 or more MLS numbers, this
needs to be normalized out into an MLSNUMBERS table that has a foreign key
into the Listings table. And possibly, another associative or "junction"
table, depending on your business logic. So when you get a DataSet back, it
can have several tables in it with keys among the tables. You can make a
DataSet behave like an "in memory" database by creating DataRelations.
-- Peter
Recursion: see Recursion
site: http://www.eggheadcafe.com
unBlog: http://petesbloggerama.blogspot.com
BlogMetaFinder: http://www.blogmetafinder.com

"Luke Davis" wrote:
I've been programming in C# for about 3 months now and I've completed a
previous project that worked a lot with data, so I know the basics.

This is what I need to do, try and see what you would do as an expert C#
programmer. I have to make a paired sales analysis which takes the same
home sold twice in a given time span and show how the price has changed to
show true market conditions.

Right now we have 120,000 rows of data that have basic home information like
so:

Table Name = Properties
Columns:
APN / Address / Bedrooms / Bathrooms / Selling Price / Zip Code / SQFT /
Selling Date / MLS Number

APN is unique to the property, but the MLS Number is unique to the database.
So if a house sells twice in the last year, it'll have two MLS Numbers, but
only one APN. I need to take all homes (APN's) that have sold more than
once (they appear twice in the database) and do some math and put it into a
GridView perhaps that looks like this:

Columns:
APN / Address / Date1 / Price$1 / Date2 / Price$2 / PriceChange$ /
TimeChange / ChangeOverTime

I need to take the address from the first entry in the database, then take
the date and price from the first entry, and the date and price from the
second entry, then do Price1 - Price2 and put that into PriceChange$, then
do the same for Date1 - Date2 for TimeChange, and finally do
(PriceChange/TimeChange) / Price1 and put that into ChangeOverTime. Then
there needs to be a column average for PriceChange$, TimeChange, and
ChangeOverTime, and they need to be loaded into variables that I can put
outside the gridview.

Alright, now I hope you might know why I came to the board for help. I'm
not really sure how to pull from different rows of a database and place them
into the same row of a table, gridview, etc.
--
Luke Davis, MCSE: Security
DEM Networks - Senior Systems Architect
7225 N First, Suite 105
Fresno, CA 93720
Office: 1 (559) 439-1000
Fax: 1 (866) 640-2041
www.demnetworks.com

Aug 14 '07 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: harish | last post by:
Friends. I have three Datasets to be populated to one Excel Workbook. but i need to populate each datasets in to one worksheet. So if i export the datasets to one excel file, sheet1 should have...
4
by: Alpha | last post by:
I have a small Window application and through out the different forms I create a different dataset. At the begining I used the Tools to drag and drop the SqlDataAdapter, connection and dataset...
2
by: Sandy | last post by:
Hello - I am used to retrieving data with stored procedures. DataSets have me baffled inasmuch as it exposes Sql statements directly in the code, however, I think I need to be working with...
6
by: lennon1 | last post by:
Hi, I have already started learning .NET and I have a question. If I want to do anything - Display Data, Navigate, Update - with database (SQL Server) in Visual Studio 2005, do I have to use all...
16
by: Luqman | last post by:
Is it recommended to use datasets in ASP.Net 2.0 / VS.Net 2005 ? Best Regards, Luqman
4
by: Ronald S. Cook | last post by:
I've always used untyped datasets. In a Microsoft course, it walks through creating typed datasets and harps on the benefits. It has you drag all these things around ..wizard, wizard, wizard......
5
by: Warex | last post by:
I am using the example from the microscuzz site on making a key but It keeps giving me an error: With DataSets.Tables("Numbers") .PrimaryKey = New DataColumn() {.Columns("Number")} End With ...
0
by: S.Tedeschi | last post by:
Hi all; as posted some days ago, I'm converting an on-line app; I used to heavily rely on strongly-typed DataSets directly dropped onto pages, and so viewed by code(-behind) as well. In the next...
12
by: BillE | last post by:
I'm trying to decide if it is better to use typed datasets or business objects, so I would appreciate any thoughts from someone with more experience. When I use a business object to populate a...
9
by: gardnern | last post by:
We have X number of data sets, of Y length each. For example... Small, Medium, Large and Red, Green, Blue, Yellow We need to generate a list of all possibilities Small Red
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.