oledb

Excel cell-values are truncated by OLEDB-provider

戏子无情 提交于 2019-11-27 14:04:10
I'm using the OleDbConnection class to retrieve data from an Excel 2000/2003 workbook: string connectionString = "Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" + filename + ";" + "Extended Properties=\"Excel 8.0;IMEX=1\";"; OleDbConnection connection = new OleDbConnection(connectionString); connection.Open(); // code to get table name from schema omitted var dataAdapter = new OleDbDataAdapter(string.Format("SELECT * FROM [{0}]", name),connection); var myDataSet = new DataSet(); dataAdapter.Fill(myDataSet, "ExcelInfo"); Now it turns out that cells in the worksheet with length greater than

What are the pros and cons of OleDB versus SQLClient?

拥有回忆 提交于 2019-11-27 13:51:41
问题 Some context: one of the systems I'm working on is a .net 2.0 web application. VB.net for the front end, and SQL Server 2005 for the backend. For a variety of reasons that have been lost to time, the original designer decided to use the .Net OleDB connection rather than the SQLClient connection. After a few years of development, this particular system is on the cusp of crossing the line from "beta" into "1.0" status. One of the things we've been talking about at this point is moving to the

Is there a “proper” way to read CSV files [duplicate]

只谈情不闲聊 提交于 2019-11-27 11:50:38
Possible Duplicate: CSV File Imports in .Net In .net, is there a standard library that should be used to read in csv files? All the samples on the web roll their own csv reader / parser, or use OleDb. It's not a problem using any of these solutions, I was just wondering if there is a generally accepted library (not that I can find), or any other "proper" way to do it? CsvReader is a pretty good one... it isn't Microsoft, but it works very well, and is a lot faster than some of the alternatives (legacy OleDb etc). One of the reasons that many people write their own is that CSV isn't quite so

Access SQL syntax error when using OleDbCommandBuilder

二次信任 提交于 2019-11-27 09:10:18
I am going to INSERT data in Access Database using OleDbDataAdapter in C# but i got an error with message Syntax Error in INSERT INTO Command BackgroundWorker worker = new BackgroundWorker(); OleDbDataAdapter dbAdapter new OleDbDataAdapter(); OleDbConnection dbConnection = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\PMS.mdb"); worker = new BackgroundWorker(); worker.WorkerReportsProgress = true; worker.DoWork += InsertJob; worker.ProgressChanged += InsertJobCompleted; worker.RunWorkerAsync(args); And InsertJob Function is: private void InsertJob(object sender,

OLEDB custom encoding

喜你入骨 提交于 2019-11-27 08:50:46
问题 My goal I need to create a .dbf file in a specific format, specified by a client. The format being dBase III .dbf with kamenicky encoding, using Integer, Character of various lengths and Double column types. Problem I got pretty much everything working, with only one hurdle in the way: the darn encoding refuses to work, in spite of a specific conversion table being written which switches original chars with those compatible with kamenicky encoding. This means that the output file ends up with

.NET OleDb parameterized query not working as expected

我只是一个虾纸丫 提交于 2019-11-27 08:38:05
问题 I'm trying to pass this Update command to a database, it completes ok with no errors but it doesnt update the database and I can't understand why? Dim Cmd As OleDbCommand Dim SQL As String Dim objCmd As New OleDbCommand Dim Con = New OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" & My.Settings.MasterPath) Dim Item = "08/08/2015" SQL = ("UPDATE [Hol Dates] SET [" & EmployeeList.Text & "]= @Htype WHERE [HDate]=@Hdate") Cmd = New OleDbCommand(SQL, Con) objCmd = New OleDbCommand

SQL Server ODBC Driver not raising errors

断了今生、忘了曾经 提交于 2019-11-27 08:00:15
问题 This question is part in a series of bugs in the Microsoft ODBC driver: ODBC driver fails to raise errors; but instead suppresses them Reading columns out of order returns incorrect results Cannot execute a stored procedure that is a SYNONYM Microsoft has said they will not be fixing these bugs in their ODBC driver. Background If i have a sample table: CREATE TABLE Wallet ( WalletID int NOT NULL, Name varchar(50) NOT NULL ) i attempt to issue sql that inserts into the table without specifying

Reading image from Access - parameter not valid

陌路散爱 提交于 2019-11-27 07:44:37
问题 I have simple database in Access .mdb file, but I don't know how to deal with: "parameter not valid" exception when Im creating Image from stream. I'v read that I need to strip 78 bytes offset (from here) but I still get a "parameter not valid" error when I call FromStream, even after stripping off the first 78 bytes. This doesn't work for me: byte[] abytPic = (byte[])dt.Rows[0]["Photo"]; byte arrary with image if ((abytPic[0] == 21) && (abytPic[1] == 28)) //It's true { byte[] abytStripped =

IN Operator in OLEDB

人走茶凉 提交于 2019-11-27 07:26:13
问题 I am using OLEDB connection to read data from excel files. I am facing issues while using IN operator in the Select query. Below is my query, string EmployeeIds = "'1231','1232','1233'"; SELECT [Employee Number],[Employee Name],[First In Time],[Last Out Time],[Total Work Hours] FROM [Sheet0$A2:J] WHERE [Employee Number] IN (?); comm.Parameters.AddWithValue("?",EmployeeIds); I am getting empty results but if I give only single value then I am getting result. Please help. 回答1: where someval in

Accessing Excel Spreadsheet with C# occasionally returns blank value for some cells

徘徊边缘 提交于 2019-11-27 06:44:25
问题 I need to access an excel spreadsheet and insert the data from the spreadsheet into a SQL Database. However the Primary Keys are mixed, most are numeric and some are alpha-numeric. The problem I have is that when the numeric and alpha-numeric Keys are in the same spreadsheet the alpha-numeric cells return blank values, whereas all the other cells return their data without problems. I am using the OleDb method to access the Excel file. After retrieving the data with a Command string I put the