通过计算将excel数据导入数据库 [英] import excel data with a calculation to a database

查看:113
本文介绍了通过计算将excel数据导入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我有一个excel文件,我设法进行了一些计算。我知道当前桥梁的资产价值。我在文件中有21个字段。在21个字段中,有7个字段只是关于桥,其余用于基于各种条件的计算。我有超过500条记录。



现在我想用vb.net做同样的事情如果可能的话。

1.读取某些字段并将其存储在数据库中。(保存桥信息的字段)。

2.执行计算时读取其余字段最后存储它们。



是否有一篇文章或资源可以提及相同的想法?由于Web中的大多数文章仅显示您可以将数据从excel导入数据库。

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.

推荐答案

您无法以任何有意义的方式存储Excel计算在数据库中:当然你不能从Excel读取计算并在数据库中运行它:两者在任何方面都不兼容。



您可以对SQL中的数据执行计算,并使用您的数据返回结果:

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:
SELECT A, B,  A + B AS Result FROM MyTable

但是你可以;只是获取一个excel公式并将其传递给SQL进行评估。

But you can;t just grab an excel formula and pass it to SQL for evaluation.


您可以使用现成的解决方案,免费 SaveToDB [ ^ ] Express加载项,用于s ave计算从Microsoft Excel到数据库的值。



另外,使用加载项,你可以配置Excel公式 [ ^ ]来自数据库视图和存储过程,例如

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 ...





如果您肯定想使用vb.net,您可能会得到计算的单元格值使用Range.Value属性。



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


这篇关于通过计算将excel数据导入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆