473,287 Members | 1,813 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,287 software developers and data experts.

Data Storage Suggestions

I have data from multiple SQL tables, some of the tables will only have one
row, while others multiple rows. I load a bunch of data from the various
tables and add them to a third party grid. With some of the rows, I perform
calculations on some of the rows and all this is loaded into the grid as
well. I am trying to figure out the best way to store all this data so that
it is easier to work with and perform calculations as users edit the grid.

Currently, I have to do lookups back to the datasets and reference each
row/column of the grid. A thought was to have some sort of dataset hold all
the combined data and calculations. Before I head off in any direction, I
thought I'd get suggestions. I also looked at the Collection class and
having several different collections but I ran into trouble getting the
related data from one collection out of another. For an idea of my data
structure, I am working with aircraft but cars will work:

Manufacturer Table - Name, City....
Automobile Table - Tire, Model, Manufacturer, (linked to manufacturer)
speed, Category (linked to category), color, seats, ac/heat
Tire Table - Manufacturer (linked to table) Tire Size, Model, Speed rating
Maintenance - Automobile (linked to table) Maintenance name, frequency,
cost, how long it takes
Global Variable - Fuel Price, Oil Price
Category Variables - Navigation Service, On-Star, Taxes, Residual Value....

I could load 5 different Automobiles, from five different manufacturers and
two different categories. In the grid, I compare the various information.

Any you have would be great.

Thanks,
Brian

microsoft.public.dotnet.framework & microsoft.public.dotnet.general

Feb 26 '06 #1
5 1601
Hello Brain,

I think the best idea is to keep the data in a dataset, you can have
multiple tables in a dataset, the table/data can be deleted/modified and
the changes can be recorded. More important, you can keep relatationship
between tables so that it can be referenced by each other. This is rather
better than collections. Not sure what the datagrid you used, but most .NET
datagrid controls should support dataset well. What do you think?
Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 27 '06 #2
Luke - Thanks for the feedback. I use the FlexGrid from Component One and
they support both bound and unbound modes.

This is the track I am on....

So would you recommend that I add a column to my dataset when I have a
calculated value. Using my car example, I'll have a data column fuel price,
miles per gallon and mile driven. Then my calculated value that I add to
the grid called Monthly Fuel Cost which is calculated from Miles Driven /
Miles per gallon * Fuel Price. Would you add the Monthly Fuel to the
dataset and if so, does help show how?

Thanks,
Brian

"Brian P. Hammer" <Br*********@community.nospam> wrote in message
news:eB**************@TK2MSFTNGP10.phx.gbl...
I have data from multiple SQL tables, some of the tables will only have one
row, while others multiple rows. I load a bunch of data from the various
tables and add them to a third party grid. With some of the rows, I perform
calculations on some of the rows and all this is loaded into the grid as
well. I am trying to figure out the best way to store all this data so
that it is easier to work with and perform calculations as users edit the
grid.

Currently, I have to do lookups back to the datasets and reference each
row/column of the grid. A thought was to have some sort of dataset hold
all the combined data and calculations. Before I head off in any
direction, I thought I'd get suggestions. I also looked at the Collection
class and having several different collections but I ran into trouble
getting the related data from one collection out of another. For an idea
of my data structure, I am working with aircraft but cars will work:

Manufacturer Table - Name, City....
Automobile Table - Tire, Model, Manufacturer, (linked to manufacturer)
speed, Category (linked to category), color, seats, ac/heat
Tire Table - Manufacturer (linked to table) Tire Size, Model, Speed rating
Maintenance - Automobile (linked to table) Maintenance name, frequency,
cost, how long it takes
Global Variable - Fuel Price, Oil Price
Category Variables - Navigation Service, On-Star, Taxes, Residual
Value....

I could load 5 different Automobiles, from five different manufacturers
and two different categories. In the grid, I compare the various
information.

Any you have would be great.

Thanks,
Brian

microsoft.public.dotnet.framework & microsoft.public.dotnet.general

Feb 28 '06 #3
Yes, dataset/datatable also support a "calculated column". You need to set
a data cloumn's Expression property, here is a sample:

Private Sub CalcColumns()
Dim rate As Single = .0862
dim table as DataTable = New DataTable

' Create the first column.
Dim priceColumn As DataColumn = New DataColumn
With priceColumn
.DataType = System.Type.GetType("System.Decimal")
.ColumnName = "price"
.DefaultValue = 50
End With

' Create the second, calculated, column.
Dim taxColumn As DataColumn = New DataColumn
With taxColumn
.DataType = System.Type.GetType("System.Decimal")
.ColumnName = "tax"
.Expression = "price * 0.0862"
End With

' Create third column
Dim totalColumn As DataColumn = New DataColumn
With totalColumn
.DataType = System.Type.GetType("System.Decimal")
.ColumnName = "total"
.Expression = "price + tax"
End With

' Add columns to DataTable
With table.Columns
.Add(priceColumn)
.Add(taxColumn)
.Add(totalColumn)
End With

Dim row As DataRow= table.NewRow
table.Rows.Add(row)
Dim view As New DataView
view.Table = table
DataGrid1.DataSource = view
End Sub

Hope this help,
Luke Zhang
(This posting is provided "AS IS", with no warranties, and confers no
rights.)

Feb 28 '06 #4
Brian,

In addition to Luke,

On of the main standards in Net is to keep the data in the dataobjects and
to show those using controls (by instance grids).

In other words, don't use the controls to do the calculations. Use the
underlying dataobjects to do that.

There are standard dataclasses, that have a lot in it, to do what is above
written.

To make it confusing has Microsoft always written that it is the DataSet
(not anymore in version 2005). It is true, however the DataSet is just a
wrapper that holds two important elments (objects instanced from classes)

Those are the DataTable with a hug amount of properties, however as well
methods (and a lack of enough events) and the DataRelation which holds the
relations between those datatables.

One of the backward point is that a DataSet represent the formats from a
DataBase and those don't have at the moment complex types or polyphorism.

Therefore as long as the DataBases don't have those, you can invent what you
want, a straigt formward method does not exist for that and should have to
create for every existence their own table (in my opinion goes this forever
wrong in maintanance) or have to accept that some fields are not used.

Another point is that you never can hold all data in a grid, two deep is
probably often confusing for a user. Although some people think it can, you
cannot use one grid to show everything. To get a methaphore all spreadsheets
have tabpages now.

Just some ideas.

Cor

"Brian P. Hammer" <Br*********@community.nospam> schreef in bericht
news:eB**************@TK2MSFTNGP10.phx.gbl...
I have data from multiple SQL tables, some of the tables will only have one
row, while others multiple rows. I load a bunch of data from the various
tables and add them to a third party grid. With some of the rows, I perform
calculations on some of the rows and all this is loaded into the grid as
well. I am trying to figure out the best way to store all this data so
that it is easier to work with and perform calculations as users edit the
grid.

Currently, I have to do lookups back to the datasets and reference each
row/column of the grid. A thought was to have some sort of dataset hold
all the combined data and calculations. Before I head off in any
direction, I thought I'd get suggestions. I also looked at the Collection
class and having several different collections but I ran into trouble
getting the related data from one collection out of another. For an idea
of my data structure, I am working with aircraft but cars will work:

Manufacturer Table - Name, City....
Automobile Table - Tire, Model, Manufacturer, (linked to manufacturer)
speed, Category (linked to category), color, seats, ac/heat
Tire Table - Manufacturer (linked to table) Tire Size, Model, Speed rating
Maintenance - Automobile (linked to table) Maintenance name, frequency,
cost, how long it takes
Global Variable - Fuel Price, Oil Price
Category Variables - Navigation Service, On-Star, Taxes, Residual
Value....

I could load 5 different Automobiles, from five different manufacturers
and two different categories. In the grid, I compare the various
information.

Any you have would be great.

Thanks,
Brian

microsoft.public.dotnet.framework & microsoft.public.dotnet.general

Feb 28 '06 #5
Luke and Cor - Thanks for the insight. I am sure I will have questions
along the way....

I will post any to the group.

Thanks,
Brian

"Cor Ligthert [MVP]" <no************@planet.nl> wrote in message
news:ul*************@tk2msftngp13.phx.gbl...
Brian,

In addition to Luke,

On of the main standards in Net is to keep the data in the dataobjects and
to show those using controls (by instance grids).

In other words, don't use the controls to do the calculations. Use the
underlying dataobjects to do that.

There are standard dataclasses, that have a lot in it, to do what is above
written.

To make it confusing has Microsoft always written that it is the DataSet
(not anymore in version 2005). It is true, however the DataSet is just a
wrapper that holds two important elments (objects instanced from classes)

Those are the DataTable with a hug amount of properties, however as well
methods (and a lack of enough events) and the DataRelation which holds the
relations between those datatables.

One of the backward point is that a DataSet represent the formats from a
DataBase and those don't have at the moment complex types or polyphorism.

Therefore as long as the DataBases don't have those, you can invent what
you want, a straigt formward method does not exist for that and should
have to create for every existence their own table (in my opinion goes
this forever wrong in maintanance) or have to accept that some fields are
not used.

Another point is that you never can hold all data in a grid, two deep is
probably often confusing for a user. Although some people think it can,
you cannot use one grid to show everything. To get a methaphore all
spreadsheets have tabpages now.

Just some ideas.

Cor

"Brian P. Hammer" <Br*********@community.nospam> schreef in bericht
news:eB**************@TK2MSFTNGP10.phx.gbl...
I have data from multiple SQL tables, some of the tables will only have
one row, while others multiple rows. I load a bunch of data from the
various tables and add them to a third party grid. With some of the rows,
I perform calculations on some of the rows and all this is loaded into the
grid as well. I am trying to figure out the best way to store all this
data so that it is easier to work with and perform calculations as users
edit the grid.

Currently, I have to do lookups back to the datasets and reference each
row/column of the grid. A thought was to have some sort of dataset hold
all the combined data and calculations. Before I head off in any
direction, I thought I'd get suggestions. I also looked at the
Collection class and having several different collections but I ran into
trouble getting the related data from one collection out of another. For
an idea of my data structure, I am working with aircraft but cars will
work:

Manufacturer Table - Name, City....
Automobile Table - Tire, Model, Manufacturer, (linked to manufacturer)
speed, Category (linked to category), color, seats, ac/heat
Tire Table - Manufacturer (linked to table) Tire Size, Model, Speed
rating
Maintenance - Automobile (linked to table) Maintenance name, frequency,
cost, how long it takes
Global Variable - Fuel Price, Oil Price
Category Variables - Navigation Service, On-Star, Taxes, Residual
Value....

I could load 5 different Automobiles, from five different manufacturers
and two different categories. In the grid, I compare the various
information.

Any you have would be great.

Thanks,
Brian

microsoft.public.dotnet.framework & microsoft.public.dotnet.general


Feb 28 '06 #6

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

Similar topics

0
by: SAQIB | last post by:
Hello All, I am trying to decide which storage I should use for the "Data Directory". My application has lots of 'SELECT's (80%) and fewer UPDATEs/INSERTs(20 %). I have the following choices...
8
by: Scott J. McCaughrin | last post by:
The following program compiles fine but elicits this message from the linker: "undefined reference to VarArray::funct" and thus fails. It seems to behave as if the static data-member:...
9
by: cryptic_blade | last post by:
I am working on the design for a new application and want to make the program fully object oriented. I have built and used C++ classes before, but never with a database driven application. Should...
6
by: kobu.selva | last post by:
I was recently part of a little debate on the issue of whether constants and string literals are considered "data objects" in C. I'm more confused now than before. I was always under the...
1
by: fred tate via .NET 247 | last post by:
I'm working on a project that will track a great deal of data forindividuals and will keep track of users for a very long time (5- 10) years. I'm looking for options as far as tracking anddisplaying...
2
by: ek1 | last post by:
Hi, I need a method in which to store data securely on windows XP/2003 using C#. By secure I want to a) prevent user reading and changing the data and b) prevent user copying over data I...
2
by: Jonathan Wood | last post by:
Hi, I'd like to build a .NET Website that has any number of documents that visitors can read. In addition to the documents, I may have one or two downloads associated with each document. I'm...
7
by: Chris Jewell | last post by:
Hi, I'm wondering what the best way of registering a data storage class with a data handler class is. At the moment I have two classes: class EpiCovars // Storage class { ....
0
by: zhensoftware | last post by:
USB storage devices have gained popularity. It can be host to viruses, Trojans, hacker toolkits, worms or other forms of malicious programs. For example, when you plug your USB disk into a computer...
2
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 7 Feb 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:30 (7.30PM). In this month's session, the creator of the excellent VBE...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: marcoviolo | last post by:
Dear all, I would like to implement on my worksheet an vlookup dynamic , that consider a change of pivot excel via win32com, from an external excel (without open it) and save the new file into a...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...

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.