我从一些Excel文件中导入了数据,并将其保存到了一个datatable.现在我想将这些信息保存在我的SQL Server数据库中.
我在网上看到了很多信息,但我无法理解:
OLE或SQL Server对象(如dataAdapter或connection)?我需要从他的Excel文件中读取员工每周工时报告并将其保存到保存所有报告的数据库表中(每周用新记录更新数据库).
Excel文件仅包含当前周的报告.
我需要使用CorruptLoad来自powershell-script的paramterer 打开excel文件.但是当我尝试制作它时,我收到了一个错误Exception calling "Open" with "15" argument(s): "open method workbooks class failed".仅当我Open使用所有15个参数调用时才会发生此错误.当我尝试使用VB.net带有15个参数的程序打开相同的excel文件或指定name参数的值时CorruptLoad,没有问题!
我正在使用powershell v 4.0Office 2010 SP2和.NET Framework 4.5.2.
这是我的powershell代码:
$excel = New-Object -ComObject Excel.Application
$excel.Visible = $false
try
{
$missing = [System.Type]::Missing
# $wb = $excel.Workbooks.Open("d:\temp\start_instrument.xls", $missing, $missing, $missing, $missing,
# $missing, $missing, $missing, $missing, $missing,
# $missing, $missing, $missing, $missing, $missing)
# $wb = $excel.Workbooks.Open("d:\temp\start_instrument.xls", $missing, $missing, $missing, …Run Code Online (Sandbox Code Playgroud) 我已经存储了返回一些数据的程序,如下所示:
Trade mode;Area;Production place;Commodity;Reseller;Min_sell_price;Max_buy_price;Trans_count;Volume;avg_price;change_avg_price;last_trade_price;last_trade_volume
"Trade mode1"; "Area name1"; "Place1"; "Commodity1"; "No"; "33601"; "33601"; "1"; "1200"; "33601"; "+28"; "33601"; "1200"
"Trade mode1"; "Area name1"; "Place1"; "Commodity1"; "Yes"; "-"; "33601"; "0"; "0"; "33601"; "+28"; "33601"; "1200"
"Trade mode1"; "Area name1"; "Place2"; "Commodity2"; "No"; "35000"; "35000"; "1"; "180"; "35000"; "0"; "35000"; "180"
"Trade mode1"; "Area name1"; "Place1"; "Commodity2"; "Yes"; "-"; "35000"; "0"; "0"; "35000"; "0"; "35000"; "180"
Run Code Online (Sandbox Code Playgroud)
我需要创建的报告是 SSRS 2008 R2,它看起来像这样:

我不知道如何合并“最高买家价格”、“商品平均价格”、“平均价格变化”、“最后交易价格”、“最后交易量”列中的单元格。我将不胜感激任何建议。
所以这是表A.
+------------+--------+----------+
| LineNumber | Pallet | Location |
+------------+--------+----------+
| 1 | a | X |
+------------+--------+----------+
| 2 | a | X |
+------------+--------+----------+
| 3 | b | Y |
+------------+--------+----------+
| 4 | b | Y |
+------------+--------+----------+
| 5 | b | Y |
+------------+--------+----------+
| 6 | c | Z |
+------------+--------+----------+
| 7 | c | Z |
+------------+--------+----------+
| 8 | c | Z |
+------------+--------+----------+
| 9 | d | Q …Run Code Online (Sandbox Code Playgroud)