English 中文(简体)
通过OlegDb的Excel显示了不同的数字......取决于电子表格是否开放?
原标题:Excel through OleDb shows numbers differently...depending on whether spreadsheet is open?

I m 开放一个Excel worksheet进入一个可使用OlegDb的数据表格:

string select = string.Format("SELECT * FROM [{0}$]", worksheetName);
using (var con = new OleDbConnection(connectionString))
using (var adapter = new OleDbDataAdapter(select, con))
{
    con.Open();
    var dt = new DataTable();
    adapter.Fill(dt);
    con.Close();
    return dt;
}

接着,我通过数据浏览读一下各种数据,如:

decimal charge;
bool isChargeReadable = 
    decimal.TryParse(row["Charge"].ToString(), out charge);

我刚刚发现,我的法典正在用美元(如“1100.00美元”)的囚室玩弄,可以 par到 de。 毫不奇怪......除此以外,这只是目前最出色地开展工作的法典。

进一步的调查显示,如果我操作该法典,而《工作手册》是开放的,则其中一间是“1100”。 如果在工作手册关闭时,我就认为“1100.00美元”。

为什么发生这种情况? 显然,在《工作手册》关闭时,我不得不重新制定我的守则,以便发挥作用,但为什么会产生影响? 我想,这只是读一下节省的工作手册。

使用Im的连接就是这样......

"Provider=Microsoft.Jet.OLEDB.4.0;
    Data Source={0};
    Extended Properties=""Excel 8.0;HDR=NO;IMEX=1"";"

......当然由Excel文档名称取代{0}。

问题回答

我发现,我的捆绑式作业在外围作业中做得更好,但产出为IMEX=编号。 也许你的问题是什么?





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签