Code sample for MS Access 2003?

Discussion of open issues, suggestions and bugs regarding ADO.NET provider for universal data access
Post Reply
marc15
Posts: 3
Joined: Sun 25 Feb 2007 12:01

Code sample for MS Access 2003?

Post by marc15 » Sun 25 Feb 2007 12:15

I am currently evaluating UniDirect.NET with VS2005. My application is supposed to work with MS Access, SQLServer and Oracle. I am new to UniDirect and I can't find any sample for connecting to an Access 2003 database through OleDb. Has anyone done this before? Could you please post a code sample please?

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Mon 26 Feb 2007 09:10

UniDirect is a .NET data provider and has nothing to do with OLE DB. It connects to MS Access using ADO.NET technology. If you are going to use OLE DB, you should consult appropriate documentation.

marc15
Posts: 3
Joined: Sun 25 Feb 2007 12:01

Code sample for MS Access 2003?

Post by marc15 » Mon 26 Feb 2007 10:02

Alexey, thank you for your quick reply. I think I misunderstood the statement on the product page saying "The provider for MS Access enables data access to Microsoft Access data sources through OLE DB.". Nevertheless, do you happen to have some lines of code showing how to connect to an MS Access database through UniDirect?

Alexey
Posts: 2756
Joined: Mon 13 Mar 2006 07:43

Post by Alexey » Thu 01 Mar 2007 08:48

To be honest, UniDirect .NET uses standard ADO.NET OLE DB provider to connect to MS Access. The connection string looks as follows:

Code: Select all

provider=MS Access;Data Source=D:\Program Files\Common Files\Borland Shared\Data\dbdemos.mdb;

iddJoe
Posts: 2
Joined: Fri 18 Sep 2009 16:26

Post by iddJoe » Fri 18 Sep 2009 16:32

Alexey wrote:To be honest, UniDirect .NET uses standard ADO.NET OLE DB provider to connect to MS Access. The connection string looks as follows:

Code: Select all

provider=MS Access;Data Source=D:\Program Files\Common Files\Borland Shared\Data\dbdemos.mdb;
Could you also post an example of using the Access connection to, say, enter some data to a table?

Thanks!

Shalex
Site Admin
Posts: 8296
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Mon 21 Sep 2009 12:43

Here is a sample:

Code: Select all

  UniConnection connection = new UniConnection(@"provider=MS Access;Data Source=D:\Program Files\Common Files\Borland Shared\Data\dbdemos.mdb;");
  UniCommand cmd = new  UniCommand("insert into table(a,b) values (1,1);", connection);
  try {
    connection.Open();
    cmd.ExecuteNonQuery();
  }
  finally {
    connection.Close();
  }

Shalex
Site Admin
Posts: 8296
Joined: Thu 14 Aug 2008 12:44

Post by Shalex » Tue 22 Sep 2009 15:39

dotConnect Universal 3.0.1 Beta is available for download now.
It can be downloaded from http://www.devart.com/dotconnect/unidir ... nload.html .
For more information, please refer to http://www.devart.com/forums/viewtopic.php?t=15900 .

Post Reply