oledb

How to insert a new row in excel using oledb c#.net

别说谁变了你拦得住时间么 提交于 2019-12-24 12:11:13
问题 I'm trying my best to insert a new data row in excel file. please have a look. i'm facing this problem using C#.net framework (3.5) code: try{ string ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=D:\\rising rent\\csharp-Excel.xls;Extended Properties='Excel 12.0;HDR=Yes;IMEX=1;MAXSCANROWS=15;READONLY=FALSE;ImportMixedTypes=Text'"; OleDbConnection conn = new OleDbConnection(ConnectionString); conn.Open(); OleDbCommand cmd = new OleDbCommand("INSERT INTO [Inventory$] (C_DATE)

Accessing a database using visual c++ and OLEDB

主宰稳场 提交于 2019-12-24 11:51:46
问题 Does anybody have an example of working with database using Visual C++ and OLEDB? What should I include on top of my code? I have searched the internet and most examples are using C# or VB. Examples written by C++ are usually not complete. I really appreciate your help. Best, Shadi. 回答1: You probably want to use ADO to do this. Writing code directly to OLE DB from C/C++ is a fair bit of work (understatement). If you google for c++ ado , there are a number of hits. The top two are this one on

Getting MsAccess table names

只愿长相守 提交于 2019-12-24 11:43:38
问题 I am looking to get all the tables given a msAccess file. The following is what I do: public override List<string> GetTables() { using (OleDbConnection con = new OleDbConnection(Path)) { con.Open(); DataTable schema = con.GetSchema("Columns"); List<string> tables= new List<string>(); foreach (DataRow row in schema.Rows) { tables.Add(row.Field<string>("TABLE_NAME")); } return tables; } } However, although all the table names are returned, it seems each one is returned 10 times. Why is it doing

How to optimize this simple but complex looking implementation in VB.Net?

眉间皱痕 提交于 2019-12-24 11:37:40
问题 Aim to achieve : Want to dump a fetched table to a excel sheet. My implementation : Imports System.Data.OleDb Private Sub getRawDataNextMonth() Dim sheetName As String = "RawData" Dim con As New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=C:\rawData.xlsx;Extended Properties=""Excel 12.0 XML;""") Dim adapter As New Data.OleDb.OleDbDataAdapter("SELECT * FROM [Sheet1$]", con) Dim dataSet As New Data.DataSet adapter.Fill(dataSet) Dim dataTable As Data.DataTable = dataSet.Tables

Inserting not committed to database

非 Y 不嫁゛ 提交于 2019-12-24 10:39:41
问题 I'm having some trouble getting my DataSet to work. I have a MDB-Database in the background and created a DataSet out of it. Now I created a new method that lets me create a new user in the table. But when I call it, nothing happens. No exceptions, no errors and I even get "1" returned as number of affected rows. But when I look in the database, no user was added. I have the feeling that I miss to somehow tell the DataSet that I want to operate the Database itself rather than just the

MS Access DB doesnt save changes after execution (C#)

岁酱吖の 提交于 2019-12-24 09:39:25
问题 I have the following code for using an access database OleDbConnection con = new OleDbConnection(myproject.Properties.Settings.Default.myDBConnectionString); con.Open(); OleDbCommand command = new OleDbCommand("INSERT INTO components (name) VALUES (@p_col1)", con); command.Parameters.Add("@p_col1", OleDbType.VarChar).Value = "test row"; int rows = command.ExecuteNonQuery(); At this point rows value is 1 and when I make select queries after that the row inserted is available. The problem comes

excel oledb fields truncated at 255

末鹿安然 提交于 2019-12-24 08:28:32
问题 I'm reading in an excel file with the following code: Function Read_Excel(ByVal sFile As String) As ADODB.Recordset On Error GoTo fix_err Dim rs As ADODB.Recordset rs = New ADODB.Recordset Dim sconn As String rs.CursorLocation = ADODB.CursorLocationEnum.adUseServer rs.CursorType = ADODB.CursorTypeEnum.adOpenStatic rs.LockType = ADODB.LockTypeEnum.adLockReadOnly sconn = "Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & sFile & ";Extended Properties=""Excel 12.0;HDR=YES;IMEX=1"";" rs.Open(

Why does VB.NET Jet 4.0 app crash if Office not installed?

喜欢而已 提交于 2019-12-24 08:24:57
问题 I'm working on a VB2008 project that references two Access databases using Provider=Microsoft.Jet.OLEDB.4.0; It would seem if the user does not have MSOffice on their machine, the program crashes with a "XXX stopped working" on startup on Vista and Win7. I thought that Windows had XP and above had Jet functionality built in? Does anyone know why this is happening? What are the correct project/publish/prerequisites required please? TIA 回答1: There is absolutely NO Jet support for x64

OLEDB slow performance when inserting multiple records from C# into an Excel spreadsheet

给你一囗甜甜゛ 提交于 2019-12-24 07:29:09
问题 I am using an OLEDB connection (Microsoft.ACE.OLEDB.12) to read records from a C# data table and put the records into an excel spreadsheet. I am looping round each record in my data table and building up OLEDBCommand.CommandText using an "Insert into table name values (" etc. I am having to format the values appropriately so that string/char/integer/decimal are inserted correctly. This all works fine and my spreadsheet is created, however when there are loads of records to insert (e.g. 500

OLEDB Connection Specific Columns

女生的网名这么多〃 提交于 2019-12-24 06:44:18
问题 I have an OLEDB data connection and I am only wanting to import columns A:O into a table. I can import all the data...successfully, but not limit it to just those columns (A:O) I am populating the Connection Properties screen.. Thanks in advance... Provider=Microsoft.ACE.OLEDB.12.0;User ID=Admin;Data Source=FILEPATH;Mode=ReadWrite;Extended Properties="IMEX=1;HDR=NO;string sql=""select * from ['SHEETNAME'$A:$O]""";Jet OLEDB:System database="";Jet OLEDB:Registry Path="";Jet OLEDB:Engine Type=35