Click here to Skip to main content
15,896,207 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I have an excel file that i managed to perform some calculation.It's to know the asset value of bridges in a current year.I have 21 fields in the file.Out of the 21 fields,seven fields are just information about the bridge,the rest are used for the calculation based on various conditions.And i have more than 500 records.

Now i wanted to do the same thing using vb.net if it's possible.
1.Read certain fields and store them in the database.(Fields holding bridge information).
2.Read the rest of the fields while performing calculation and lastly store them.

Is there an article or resource to refer to that mentions the same idea? Since most of the articles in the web only show that you can just import data from excel to a database.
Posted

You can't store Excel calculations in any meaningful way in the database: certainly you can't "read" a calculation from Excel and "run" it in the database: the two are not in any way compatible.

You can perform calculations on data within SQL, and return teh results with your data:
SQL
SELECT A, B,  A + B AS Result FROM MyTable
But you can;t just grab an excel formula and pass it to SQL for evaluation.
 
Share this answer
 
Comments
Nebilo 24-Jun-14 8:53am    
No i don't want to read the calculation.I wanted to write the calculation in vb.net and apply that when a record is read.
You may use a ready solution, the free SaveToDB[^] Express add-in, to save calculated values from Microsoft Excel to a database.

Also, using the add-in, you may configure Excel formulas[^] from database views and stored procedures like
SELECT Name, Price, Qty, '=[@Price]*[@Qty]' AS [Sum] FROM ...


If you definitely want to use vb.net, you may get calculated cell values using the Range.Value property.
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900