p2p.wrox.com Forums

p2p.wrox.com Forums (http://p2p.wrox.com/index.php)
-   C# (http://p2p.wrox.com/forumdisplay.php?f=22)
-   -   Can't open .MDB database (http://p2p.wrox.com/showthread.php?t=5870)

saxitalis November 6th, 2003 03:53 PM

Can't open .MDB database
 
Hello,

I am a beginning programmer. Problem:

I am trying to open a Microsoft ACCESS database using OLEDB. The exception raised when trying to open the .MDB is "database is not registered on this machine"

Here is the code I am using:

using System;
using System.Data;
using System.Data.OleDB;

namespace Wrox.BeginningCSharpDatabases.Chapter05
{
  class Connection_OleDB {
    static void Main()
    {
      OleDBConnection thisConnection = new OleDBConnection(
                               @"Provider=Microsoft.Jet.OLEDB.4.0;" +
                                @"Data Source=c:\Northwind.MDB");

    // Open connection
    thisConnection.Open();
    }//end Main

No access databases will open. I am able to open SQL databases (by changing appropriate references)just fine.

How do you register an Access database on the local (or) remote machine???

Thanks so much in advance,

Baffled,
Saxitalis

jacob November 7th, 2003 04:18 PM

What are the '@' there for!? My connection strings look something like this...
Code:

Provider=Microsoft.Jet.OLEDB.4.0;Data Source=D:\someDatabase.mdb
Jacob.


All times are GMT -4. The time now is 08:32 PM.

Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.