Design issue using ADO.NET and ASP.NET

R

roger beniot

I have an MS Access database that contains one table with the
following information:

Date
Gallons
Mileage

I created an ASP.NET web appliation that can access the table via
ADO.NET (using oleDB controls) so I can display the info in a web page
using a DataGrid control.... Currently I have this working w/ no
problems.

The next thing I would like to do is add another column to the
DataGrid and calculcate the miles per gallon (MPG)... So my questions
are:

1) is it better to do the calculation in the database (ie. have a
field in the database for this) or should I calculate the value in the
Web app's code behind when it is initializing the DataGrid?

2) how can I calculate the fields value using Access? It doesn't seem
possible in Access to calculate values via formulas like it is in
Excel.

3) If I calculate the value in the web app, how do I populate the
value into the DataGrid?


#1, it would seem better to already have the value calculated in the
database ahead of time so the web app can load faster (w/out having to
do the calculations)... but as #2 shows I'm unable to figure out how
to calculate/populate the field in Access (I realize this is a
question for another group... but if anyone has an answer I'd
appreciate it).

Thanks in advance,
roger
 
S

SB

Roger,
I would go for the Access solution,
In Access, create a query, and either:
- In design view, you add a new column with the field as follows:
Miles_Per_Gallons:[Gallson]/[Mileage]
or
- In Sql: SELECT Date, Gallons, Mileage, [Gallons]/[Mileage] As
Miles_Per_Gallons FROM MYTABLE
Selim
 
R

roger beniot

I solved my problem... you can create a query in Access that calculates a value.

-roger
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top