oledbconnection

OLEDBConnection.Open() generates 'Unspecified error'

I have an application that uploads an Excel .xls file to the file system, opens the file with an oledbconnection object using the .open() method on the object instance and then stores the data in a database. The upload and writing of the file to the file system works fine but I get an error when trying to open the file on our production...

ASP.NET OleDbConnection Problem

I'm working on an ASP.NET website where I am using an asp:repeater with paging done through a VB.NET code-behind file. I'm having trouble with the database connection though. As far as I can tell, the paging is working, but I can't get the data to be certain. The database is a Microsoft Access database. The function that should be acces...

C# Issue: What is the simplest way for me to load a .MDB file, make changes to it, and save the changes back to the original file?

My project that I am working on is almost finished. I am loading a .MDB file, displaying the contents on a DataGrid and attempting to get those changes on the DataGrid and save them back into the .MDB file. I am also going to create a function that allows me to take the tables from one .MDB file and save it to another .MDB file. Of cours...

Best way to check OleDbConnection state

Apparently (MSDN) sometimes OleDbConnection.ResetState() does nothing, so even if the connection fails OleDbConnection.State will still be set to Open. I am looking for best workaround for this, so that when I check connection state I can avoid raising exceptions (as long as connection hasn't failed between the last check and usage attem...

Excel cell-values are truncated by OLEDB-provider

Hi folks, 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 OleDbConnec...

OLE DB Exception - database/user/password is too large

I'm trying to connect to a database using OleDbConnection and a connection string, the error given within the try-catch statement is 'database/user/password is too large'. What does that statement mean, and how can I solve this problem so I can connect to my database? My database is using a SQLBase driver. ...

Obtaining First Excel Sheet Name With OleDbConnection

Hi, I have one problem. I need to get the excel sheet name in a work book, which looks on the very left sheets tab -the first one from my point of view. I am using this code: public static string GetFirstExcelSheetName(OleDbConnection connToExcel) { DataTable dtSheetName = connToExcel.GetOleDbSchemaTable(OleDbSchemaGuid.Tables, ...

SELECT through oledbcommand in vb.net not picking up recent changes.

I'm using the following code to work out the next unique Order Number in an access database. ServerDB is a "System.Data.OleDb.OleDbConnection" Dim command As New OleDb.OleDbCommand("", serverDB) command.CommandText = "SELECT max (ORDERNO) FROM WORKORDR" iOrder = command.ExecuteScalar() NewOrderNo = (iOrder + 1) If I subsequently creat...

Excel reading in ASP.NET : Data not being read if column has different data formats

I have an asp.net C# application where i am reading the contents of a spreadsheet using OLEDBConnection. I am using the below line of code to read from the excel spreadsheet. OleDbConnection con = new OleDbConnection(@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fullFilePath + ";Extended Properties='Excel 8.0;HDR=Yes;IMEX=1'"); ...

Reading an XLS file with the Microsoft Jet Engine

Hi, I want to allow my application to allow import of data through XLs files. I already do this with CSV files and XML files, but would like to open the scope for users. I am having trouble with the loading of the file. We load the files (XLS,CSV,Xml) into a data set and work on it from there. The loading code for XLS is below ...

Example of Where cluase query including the MSACCESS database connection in C#

similar to title. just want an example of Oledb connection with Where clause query. ...

OleDbConnection failed creating a new excel file

I have to use OleDbConnection to create a new excel file, but when I open connection with this string: OleDbConnection excelConnection = new OleDbConnection( String.Format( @"Provider=Microsoft.ACE.OLEDB.12.0;Data Source={0};Mode=ReadWrite;Extended Properties=""Excel 12.0;HDR=Y...

Connecting MS Access 2000 Database (.mdfb) file in ASP.NET 3.5

How to connect Access 2000 Database (.mdb) file in ASP.NET 3.5 ? In OleDBConnection object i have selected provider as Microsoft Access Database File (OLE DB) and specified the (.mdb) file. But I am receiving unspecified error as error message. ...

Why does 'MSysNavPaneGroupCategories' show up in a .NET OleDbProvider initiated query to an MS Access 2K database when the criteria specifies "WHERE MSysObjects.Name NOT LIKE 'MSys*'"?

I want to list all tables and their row count, in an MS Access database, in a grid view. I am using a query as follows: SELECT MSysObjects.Name, CLng(DCount('*',[name])) AS RecordCount FROM MSysObjects WHERE (((MSysObjects.Type)=1) AND (MSysObjects.Name NOT LIKE 'MSys*')) ORDER BY MSysObjects.Name; In MS Access Query pane this works j...

Windows Service hangs when opening OLEDB-connection to Excel-file

I have a Windows Service that hangs when opening an OLEDB-connection to an Excel-file, like this: using (var connection = new OleDbConnection( "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=\"Excel 8.0\"")) { connection.Open(); // start using the connection } This code works fine when r...

OleDb database to DataSet and back in c#?

I'm writing a program that lets a user: Connect to an (arbitrary) database that the user specifies View all of the tables in that database in separate DataGridViews Edit them in the program, generate random data, and see the results Choose to commit those changes or revert So I discovered the DataSet class, which looks like it's capa...

Access Database Connection

I am using C#.net application with oledbConnection to open database in exclusive mode what exactly process in backend when we open database in exclusive mode , it not increse size of database compare to shared mode connectivity. Is it doing Compat or Repair when it close connection of Exclusive Mode?? As we are facing unExpected Error...

How to force ADO.Net to use only the System.String DataType in the readers TableSchema.

Howdy, I am using an OleDbConnection to query an Excel 2007 Spreadsheet. I want force the OleDbDataReader to use only string as the column datatype. The system is looking at the first 8 rows of data and inferring the data type to be Double. The problem is that on row 9 I have a string in that column and the OleDbDataReader is returni...

Can't update date in aspx to a MS-ACCESS table

Hello I'm having problem with updating datatypes I insert the date in the C# part like this string strSQL = "INSERT into Frettir (CreatedBy,CreatedOn,Title,Description,Starts,Ends,CatId,SectionId,ArticleExt,Myndatexti,MyndUrAlbumi,NrMyndar) values(?,?,?,?,?,?,?,?,?,?,?,?)"; cmd.Parameters.Add("@Starts",OleDbType.Date).Value = dstart...

Access Database connect C# local director

I want my connection to the database to be available all the time, so if i move the folder with the project, to an other computer, the connection to be made automaticaly. So, how can i change this connection: this.oleDbConnection1.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=\"C:\\Documents and Settings\\Cristi\\Do" ...