oledb

First item in excel omitted in results (DataSet, OleDB)

你离开我真会死。 提交于 2019-12-11 15:58:16
问题 [Sample.xlsx] Column 0, Row 0 = "ItemA" Column 0, Row 1 = "ItemB" Column 0, Row 2 = "ItemC" Column 0, Row 3 = "ItemD" [Application] DataSet dsData = new DataSet(); string strConn = @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source=Sample.xlsx;Extended Properties='Excel 12.0;'"; OleDbDataAdapter daGetExcel = new OleDbDataAdapter("SELECT * FROM [Sheet1$]", strConn); daGetExcel.Fill(dsData); foreach (DataRow row in dsData.Tables[0].Rows) { lbExcelData.Items.Add(row[0].ToString()); } lbExcelData is

Update Excel 2007 with OleDb

烈酒焚心 提交于 2019-12-11 15:44:43
问题 Attempting to execute an update command against an Excel 2007 file gives the error: Operation must use an updateable query. I'm using System.Data.OleDb with a connection string like this: Dim strConn As String = "Provider=Microsoft.ACE.OLEDB.12.0;" & _ "Data Source=""" & pathToFile & """;" & _ "Extended Properties=""Excel 12.0;HDR=YES""" I have tried setting ReadOnly=false but that gives Could not find installable ISAM. I have also tried setting Mode=ReadWrite and IMEX=1 which didn't seem to

Insert values into an Access Database that contain brackets/braces

泪湿孤枕 提交于 2019-12-11 15:35:47
问题 Using taglib-sharp and OleDb, I'm attempting to index a folder of music files and store all the metadata from said files in an Access Database (I'll probably switch to SQL Compact or something later but the book I have uses Access). The below code should retrieve and store the metadata of the first 1000 files in a given folder and subfolders OleDbCommand cmd = con.CreateCommand(); DirSearch(@"C:\Users\Stephen\Music"); TagLib.File tagFil; for (int i = 0; i < 1000; i++) { tagFil = TagLib.File

Access DB in network folder cannot be read by ASP.NET

隐身守侯 提交于 2019-12-11 15:09:33
问题 I have an ASP.NET page that needs to push some data to an older program that uses an Access 2003 database for a backend. I have my connection strings all set up to do this (successful to a local copy of the DB) but when I try to read from the database on its network share location, I get the following error: Record(s) cannot be read; no read permission on 'tblDevice'. There are no passwords or any security on the database, so I'm pretty sure this is network related. I'm not aware of any way

Increase performance on OleDB insert into statement, BeginTransaction CommitTransaction

怎甘沉沦 提交于 2019-12-11 14:52:38
问题 I have written to append functions that insert data from custom c# list into MSAccess. The first simply sets up a new connection for each individual recordset: public static void appenddatatotable(string connectionstring, string tablename, string[] values) { var myconn = new OleDbConnection(connectionstring); var cmd = new OleDbCommand(); cmd.CommandText = "INSERT INTO " + tablename + " ([RunDate],[ReportingGroup], [Tariff], [Year]) VALUES(@RunDate, @ReportingGroup, @Tariff, @Year)"; cmd

Can't find referenced sheet in excel file while trying to read from a webpage in VB.Net

ぐ巨炮叔叔 提交于 2019-12-11 14:27:00
问题 I'm trying to build a webpage that allows a user to choose an excel file and then the page will read the contents of the page and upload the data to the DB after validation. I have a fileUpload asp control with a button for execution and a gridview to display the data. This isn't the end-goal, but I have it simply to test if the script is reading the file successfully (which it isn't). The error I keep getting is: "The Microsoft Office Access database engine could not find the object 'Sheet1'

Update multiple rows in access database using oledb parameters

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 14:07:11
问题 I am trying to update multiple rows in a access database using parameters. I already have to code to insert to a database, but I need same type of code to update the database. My update string looks like this Update tblitem set instock='value' where itemcode='value2' Here is my code to insert: strSQL = "insert into tbltrans2 (transid,itemcode,itemname,qty,price,[total],btw) values ( ?,?,?,?,?,?,?)" Using cn As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + Application

OleDbDataAdapter internal error: invalid row set accessor. Status=UNSUPPORTEDCONVERSION

拥有回忆 提交于 2019-12-11 13:57:56
问题 I am currently trying to move an application from a Microsoft Access database to an SQL Server Compact Edition one. I have managed to convert the database using SSMA and SQL Toolbox, but I am having some errors using the old c# code for queries (as expected). I have been able to fix things as I go along so far, but I am a bit stumped with this one: OleDbDataAdapter internal error: invalid row set accessor: Ordinal=# Status=UNSUPPORTEDCONVERSION After looking around on stackoverflow and google

Case Sensitivity when querying SQL Server 2005 from .NET using OleDB

|▌冷眼眸甩不掉的悲伤 提交于 2019-12-11 13:35:21
问题 I have a query that I'm executing from a .NET application to a SQL Server database and it seems to take quite a while to complete (5+ Minutes). I created a test app in c# to try to see what was talking so long (the query should return quickly). As I was reconstructing the query by adding in elements to see which portion was taking so long, I ended up reconstructing the query practically verbatim where the only difference was the spaces in the original query and a capitalization difference.

How to pass table name as parameter in OleDB?

耗尽温柔 提交于 2019-12-11 13:08:34
问题 private void button1_Click(object sender, EventArgs e) { string tablename = label2.Text; string name = TextBox1.Text; DBconnection.savetodb(tablename, name); } I call the method below from another form to save the name into a specific table. But it wont save into my table in database. public static void savetodb(string tablename, string name) { OleDbConnection connection = GetConnection(); string query = String.Format("INSERT INTO {0} (Name) VALUES (@Name)", tablename); OleDbCommand cmd = new