oledb

Keeping an application database agnostic (ADO.NET vs encapsulating DB logic)

荒凉一梦 提交于 2019-12-17 15:57:18
问题 We are making a fairly serious application that needs to remain agnostic to the DB a client wants to use. Initially we plan on supporting MySQL, Oracle & SQL Server. The tables & views are simple as are the queries (no real fancy SQL), therefore the question: Use native DB drivers (MySQLDbConnection etc.) and encapsulate the logic of executing queries and processing results or Use a generic OleDbConnection Obviously option 2 involves no overhead, but I presuming the performance is not as

How can I export data to an Excel file

╄→尐↘猪︶ㄣ 提交于 2019-12-17 15:49:16
问题 I have an Excel file with data in it. I want to write some specific rows of it to another Excel file that I created by code. By the way I have the indexes of these rows in a list. How can i do that? 回答1: MS provides the OpenXML SDK V 2.5 - see https://msdn.microsoft.com/en-us/library/bb448854(v=office.15).aspx This can read+write MS Office files (including Excel)... Another option see http://www.codeproject.com/KB/office/OpenXML.aspx IF you need more like rendering, formulas etc. then there

Ms Access - System resource exceeded inserting rows

人盡茶涼 提交于 2019-12-17 14:57:16
问题 I want to insert 1500 rows to Ms access database from vb.net datagridview. Inserting up to 400 rows no issue, but above 400 rows its showing error - System resource exceeded. Im using below code. The error is highlighting to: readinputs = dbup.ExecuteReader() and sometimes .ExecuteNonQuery() Dim Dbcon As New OleDbConnection(connStr) Dbcon.Open() Dim query As String Dim dbup As New OleDbCommand Dim readinputs As OleDbDataReader For x As Integer = 0 To IncomingMailDGV.Rows.Count - 1 Dim

OleDbCommandBuilder creates SQL statements that result in “syntax error”

依然范特西╮ 提交于 2019-12-17 14:56:19
问题 Can someone please explain why, when I click the "Commit" button, I get the error Syntax error in INSERT INTO statement. Here's the code. Public Class Form3 Dim inc As Integer Dim MaxRows As Integer Dim con As New OleDb.OleDbConnection Dim ds As New DataSet Dim da As OleDb.OleDbDataAdapter Dim sql As String Private Sub Form3_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load con.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source = D:\TA_Officers

Trying to insert DateTime.Now into Date/Time field gives “Data type mismatch” error

心不动则不痛 提交于 2019-12-17 04:08:03
问题 If I try to write a datetime to a record in an MS-Access database the easy way, like this cmd.CommandText = "INSERT INTO [table] ([date]) VALUES (?)"; cmd.Parameters.AddWithValue("?", DateTime.Now); I get an exception saying "Data type mismatch in criteria expression." Can anybody tell me why? What goes wrong here? After a little experimentation, I found that I can make it work if I write OleDbParameter parm = new OleDbParameter("?", OleDbType.Date); parm.Value = DateTime.Now; cmd.Parameters

Using Excel OleDb to get sheet names IN SHEET ORDER

隐身守侯 提交于 2019-12-17 01:41:29
问题 I'm using OleDb to read from an excel workbook with many sheets. I need to read the sheet names, but I need them in the order they are defined in the spreadsheet; so If I have a file that looks like this; |_____|_____|____|____|____|____|____|____|____| |_____|_____|____|____|____|____|____|____|____| |_____|_____|____|____|____|____|____|____|____| \__GERMANY__/\__UK__/\__IRELAND__/ Then I need to get the dictionary 1="GERMANY", 2="UK", 3="IRELAND" I've tried using OleDbConnection

Using Excel OleDb to get sheet names IN SHEET ORDER

南楼画角 提交于 2019-12-17 01:41:13
问题 I'm using OleDb to read from an excel workbook with many sheets. I need to read the sheet names, but I need them in the order they are defined in the spreadsheet; so If I have a file that looks like this; |_____|_____|____|____|____|____|____|____|____| |_____|_____|____|____|____|____|____|____|____| |_____|_____|____|____|____|____|____|____|____| \__GERMANY__/\__UK__/\__IRELAND__/ Then I need to get the dictionary 1="GERMANY", 2="UK", 3="IRELAND" I've tried using OleDbConnection

How to traverse multiple folders & multiple files & dump data to SQL tables with same filename? SSIS

久未见 提交于 2019-12-14 03:53:08
问题 This will be a bit of an update from the question I asked here before. I need to traverse folders & dump txt files to SQL tables with the same name (barring the .txt extension) My folder/file structure is setup as shown below Now the FileA,B,C are consistent throughout all the folders & there happens to be a [dbo].[FileA],[dbo].[FileB],[dbo].[FileC] etc sitting on the server. So Data1 Folder will have FileA,FileB...FileZ & so will Data200 Folder. The goal is to traverse through all the

i cant insert data in ms access database through textbox [closed]

南楼画角 提交于 2019-12-14 03:29:43
问题 This question is unlikely to help any future visitors; it is only relevant to a small geographic area, a specific moment in time, or an extraordinarily narrow situation that is not generally applicable to the worldwide audience of the internet. For help making this question more broadly applicable, visit the help center. Closed 6 years ago . I have a database and i use MS ACCESS 2007. I wanted to insert data into the database through textbox. I have this code below but I got errors.

Inserting Bulk Data in SQL: OLEDB IRowsetFastLoad vs. Ado.Net SqlBulkCopy

旧巷老猫 提交于 2019-12-14 02:26:08
问题 I am evaluating different methods for inserting large amount of data in SQL server. I've found SqlBulkCopy class from Ado.Net and IRowsetFastLoad interface from OLEDB. As far as I know, IRowsetFastLoad doesn't map to C#, which is my base platform, so I am evaluating if it would be worth it to create a wrapper around IRowsetFastLoad for .net, so I can use it on my application. Anyone knows if IRowsetFastLoad would actually perform better than SqlBulkInsert -- Would it be worthy to create such