I have a C# application that connects to a named SQL Express instance on the local machine using OleDBConnection:
_connection = new OleDbConnection(_strConn);
_connection.Open();
_strConn is something like this: "Provider=sqloledb;Data Source=.\NAMEDINSTANCE;Initial Catalog=dbname;User Id=sa;Password=password;"
If I debug the applica...
Hello,
I'm trying to insert in an Access Database, from visual C#. But i got this error: error
What am I doing wrong in code? The values are correct, they comes from the input boxes.
Thanks!
...
Hello,
I have a visual C# project and i'm trying to insert data in a MS Access Database when i press a button. Here is the code:
private void button1_Click(object sender, EventArgs e)
{
try
{
OleDbDataAdapter adapter=new OleDbDataAdapter();
adapter.InsertCommand = new OleD...
Hi all
I am using Microsoft.Jet.OleDb.4.0 provider to obtaint data from Excel files. Here's the connection string and it works properly:
string conn = "Provider=Microsoft.Jet.OleDb.4.0;Data Source=source.xls;Extended Properties=\"Excel 8.0;HDR=Yes;IMEX=1\"";
The problem is that I want whenever excel file was opened or to be using by a...
In the code below, the Provider object only has one instance of a DbConnection. Each reader will reference the same connection instance. According to the Microsoft documentation, the second reader will get a second connection from the connection pool. This works correctly.
using (var reader1 as IDataReader = Provider.GetReader(sqlStatem...
how to connect Sqlcompact via. OleDbConnection
my code:
string strConn = "Provider=Microsoft.SQLSERVER.CE.OLEDB.3.5; Data Source=C:\\newservice\\UserDataBase\\demo1.sdf;Password=MyPassword";
conn = new OleDbConnection(strConn);
conn.Open();
DataTable dtTable = new DataTable("Record");
OleDbDataAd...
i am using the following code to convert an excel set of data on a worksheet to a C# dataTable:
var connection = new OleDbConnection("Provider=Microsoft.ACE.OLEDB.12.0;Data Source=" + _filename + ";Extended Properties=\"Excel 12.0;HDR=YES\";");
var adapter = new OleDbDataAdapter("SELECT * FROM [owssvr$]", connection);
c...
In a C# application, should a OleDBConnection be created once, or every time a SQL statement is executed?
I am looking at C# code written by someone else. Every SQL statement is preceded with the creation of an OleDbConnection object whose connection string points to an MDB database.
Is it appropriate to create an OleDbConnection obje...
I have a program that imports data from Excel into a dataset. To connect to Excel I use the following code...
return new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;" + "Data Source=" +
fileName + "; Jet OLEDB:Engine Type=5;"+ "Extended Properties=\"Excel 8.0;\"");
I just got a new computer with Excel 2010 and now the connectio...
I have an ASP.NET web application that has a fileupload control to allow users to upload an excel file for it to read.
I'm using an OleDBConnection and I feel like my connection string or querystring is wrong since the app keeps throwing OleDBExceptions at me (ouch!). What would be a good way to save or access the uploaded files?
Here...
I am reading the contents of an excel sheet in my application using:
OleDbConnection con = new OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + fileName + ";Extended Properties=Excel 8.0");
_myDataSet = new DataSet();
OleDbDataAdapter myCommand = new OleDbDataAdapter(" SELECT * FROM [" + "My Sheet" + "$]", con);
myC...
Hi guys,
First, I want to say that I'm out on deep water here, since I'm just doing some changes to code that is written by someone else in the company, using OleDbDataAdapter to "talk" to Excel and I'm not familiar with that. There is one bug there I just can't follow.
I'm trying to use a OleDbDataAdapter to read in a excel file with ...
Hello,
I have to create a .NET project to monitor some oledb connections, I explain:
my client have lots of big winform(c#) projects that use some class (witch contain oledb variable) and these projects crashes when a disconnection (due to network or database,...) occur , to avoid this problem, I can't resolve all these projects (too ...
After several hours (~6 hours Win7 64bit, ~24hours WinXP) of running multi-threaded (.NET Framework 3.5 SP1 WinForms) desktop application using .mdb files as backend I'm getting the following runtime error:
Exception -> Unspecified error
StackTrace ->
at
System.Data.OleDb.OleDbConnectionInternal..ctor(OleDbConnectionS...