Tag: oledb

将Excel文件中的内容与图像存储在DataTable中

我在互联网上search,但没有find与我的情况相匹配的东西。 我正在使用OleDb来读取Excel文件。 现在我有一个文件,其中包含一个图像(连同文本)。 是否有可能以某种方式将Excel文件中的文本存储到DataTable中,而且还可以像在文件中一样在同一个星座中存储Image? 提前致谢!

数据驱动编码UItesting:如何设置Access数据库(oledb)的数据源?

我编写了一个使用Excel电子表格数据的Visual Studio数据驱动编码的UItesting。 连接如下所示: [TestMethod, DataSource("System.Data.Odbc", @"Dsn=Excel Files;Driver=(Microsoft Excel Driver (*.xls)}; dbq=C:\Test Deliverables\Flydekasser\Data\Flydekasser beregning.xls; defaultdir=C:\Test Deliverables\Flydekasser\Data;driverid=790;maxbuffersize=2048;pagetimeout=5;readonly=true", "kasse beregning$", DataAccessMethod.Sequential), DeploymentItem(@"C:\Test Deliverables\Flydekasser\Data\Flydekasser beregning.xls")] 但是,现在我想让它使用来自Access数据库(oledb)的数据。 任何人都可以帮我改变我的代码吗?

条件expression式中的OleDb数据types不匹配

我目前正试图写入一个Excel文件。 我使用这段代码: public void UpdateExcelFile(string dir, string sheet, string sql) { System.Data.OleDb.OleDbConnection MyConnection; System.Data.OleDb.OleDbCommand myCommand = new System.Data.OleDb.OleDbCommand(); MyConnection = new System.Data.OleDb.OleDbConnection(String.Format("provider=Microsoft.Jet.OLEDB.4.0;Data Source='{0}';Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=0;MAXSCANROWS=0\";", dir)); MyConnection.Open(); myCommand.Connection = MyConnection; myCommand.CommandText = sql; myCommand.ExecuteNonQuery(); MyConnection.Close(); if (myCommand != null) { myCommand.Dispose(); myCommand = null; } if (MyConnection != null) MyConnection.Dispose(); } 我遇到了“标准expression式中的数据types不匹配”exception。 我的发言如下: string cmdString […]

Oledb或ODBC创build没有安装Office的工作簿或工作表

我有一个2008R2服务器与SQL和IIS; 没有安装MS-Office套装,但是我需要根据用户请求发送dynamic创build的Excel回复。 安装“Microsoft Access数据库引擎2010可再发行组件”,根据规范,Excel驱动程序(等)应该到位。 试图用下面的连接string创build一个新的数据库: Using ExcelConnection As New System.Data.OleDb.OleDbConnection( "Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source=" + Name + ";" + "Mode=ReadWrite;" + "ReadOnly=false;" + "Extended Properties=Excel 12.0;") ExcelConnection.Open() …. end Using 错误 [OleDbException (0x80004005): Could not find installable ISAM.] System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionString constr, OleDbConnection connection) +318 System.Data.OleDb.OleDbConnectionFactory.CreateConnection(DbConnectionOptions options, DbConnectionPoolKey poolKey, Object poolGroupProviderInfo, DbConnectionPool pool, DbConnection owningObject) +88 System.Data.ProviderBase.DbConnectionFactory.CreateConnection(DbConnectionOptions […]

无法连接到Excel文件作为数据源

我正在做一个旧的(约2004年)ASP.NET 2.0应用程序。 一项function是允许用户通过Excelfile upload数据。 之前做过这些(虽然有了更新的技术),但我觉得这很简单。 我遇到的问题是我无法使用Excel文件作为数据源,无论我使用什么提供程序。 我能够连接到SQL Server数据库就好了。 我遇到的第一个问题是当我试图通过OleDB连接。 每次我尝试连接,我收到一个错误。 我正在运行64位W7,并安装了32位的办公室(无法更改,工作笔记本电脑)。 我尝试的连接string是 Provider=Microsoft.ACE.OLEDB.12.0; DataSource='{0}'; Extended Properties='HDR=YES;' Provider=Microsoft.ACE.OLEDB.12.0; DataSource='{0}'; Extended Properties='Excel 12.0 Xml;HDR=YES;' Provider=Microsoft.ACE.OLEDB.12.0; DataSource='{0}'; Extended Properties='HDR=YES;' Provider=Microsoft.JET.OLEDB.4.0; DataSource='{0}'; Extended Properties='Excel 12.0 Xml;HDR=YES;' Provider=Microsoft.ACE.OLEDB.12.0; DataSource='{0}'; Extended Properties='HDR=YES;' Provider=Microsoft.JET.OLEDB.4.0; DataSource='{0}'; Extended Properties='Excel 12.0 Xml;HDR=YES;' 我收到的错误是 The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. 我做了一些研究,发现人们试图解决这个问题的几种不同的方式,从下载2007年访问驱动程序,2010年,通过C:\Windows\SysWow64\odbcad32.exe添加它,并build立在x86模式的应用程序(不'不pipe怎么说,不知道为什么)。 所有这些都导致了相同的错误。 […]

是否可以在不安装的情况下使用“Microsoft.ACE.OLEDB.12.0”提供程序?

我有一个依赖于Microsoft.ACE.OLEDB.12.0提供程序的Excel读取库 – 我想要一种方法来使用它,而不必强制安装Access数据库引擎。 可能吗? 例如xcopy部署+聪明的COM欺骗。

C#使用Oledb datagridview更新Excel

namespace PROCESS_FOLDER_V2 { public partial class OrganiZe : Form { public OrganiZe() { InitializeComponent(); } int TotalCnt = 0; private void Insert(int Col1, string Col2, string Col3, string Col4, int Col5) { // MessageBox.Show("SNo: " + Col1 + "\n"+"\n" + "Material Code " + Col2 + "\n"+"\n" + "Item Text :" + Col3 +"\n"+"\n"+ "PO […]

Oledb连接在从Excel中读取时提供垃圾值

我在Excel文件中有一个datetypes列。 当我正在尝试使用OLEDB命令从Excel中读取值时,一些垃圾值被插入到数据表中。 例如,如果exceldate列中的数据是0-Jan = 00,则其读数为31-12-1899 12:00:00 AM。 如何避免或读取数据表中的相同值? 注意:除此之外,所有其他date值都正确读取。 这是我正在使用的连接string。 string con = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + fileLocation + ";Extended Properties=\"Excel 12.0 Xml;IMEX=1;TypeGuessRows=0;ImportMixedTypes=Text\"";

如何获得使用C sharp放置在excel中的oledb对象的文件path和标签?

这是我第一次在网站上,所以我可能不确定如何提问。 仍然在这里: 我有一个包含OLEdb对象forms的XML文件的Excel文件。 我需要的是: 如何使用C#获取存储在OLEdb中的XML文件的标签和文件path。 注意:OE1.name没有让我正确的事情。 我曾经尝试过 – private void button2_Click(object sender, EventArgs e) { xlapp = new Excel.Application(); xlwb = xlapp.Workbooks.Open("C:\\Users\\Vijay\\Documents\\File1.xlsm"); xlws = xlwb.Worksheets["Sheet1"]; foreach (Excel.OLEObject OE1 in xlws.OLEObjects()) { MessageBox.Show(Convert.ToString(OE1.Name)); } xlwb.Close(); xlapp.Quit(); }

在Windows上find可用的OleDb驱动程序

我有一个使用OleDB连接打开Excel工作簿的项目。 不同的人有安装不同版本的Office。 如果连接string是这样创build的: var connectionString = $"Provider=Microsoft.ACE.OLEDB.12.0;Extended Properties=Excel 12.0 XML;Data Source={workBookFilePath}"; 有些用户会得到一个exception: System.InvalidOperationException : The 'Microsoft.ACE.OLEDB.12.0' provider is not registered on the local machine. 我该如何智能地获取机器上可用的提供程序,只有在没有提供程序时才会抛出exception?