locked
connecting to a Access Database (zoubir) - 8/5/2006 6:48 AM PST RRS feed

  • Question

  • By: zoubir

    hi,
    
    i have difficulty to fogure out how to connecte to an access database using 
    perhaps using OleDbConnection, oleDbCommand  etc like I use to do with dotnet 
    2.0.
    
    Any help ? thanks
    Tuesday, February 19, 2008 1:41 AM

Answers

  • By: Michael G. Emmons

    This is a question better addressed to a C# or VB.NET newsgroup as it is not 
    EID specific. However, here's a quick overview of connecting to any data 
    source:
    
    To access data in a database, you must first establish a connection using an 
    ADO.NET connection object.
    
    OleDbConnection cnADONetConnection = new OleDbConnection();
    cnADONetConnection.ConnectionString = 
    @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\contacts.mdb";
    cnADONetConnection.Open();
    
    From there you'll issue queries which will return datasets. 
    
    Michael G. Emmons
    http://wpfguru.com
    
    "zoubir" wrote:
    
    > hi,
    > 
    > i have difficulty to fogure out how to connecte to an access database using 
    > perhaps using OleDbConnection, oleDbCommand  etc like I use to do with dotnet 
    > 2.0.
    > 
    > Any help ? thanks
    Tuesday, February 19, 2008 7:09 PM

All replies

  • By: Michael G. Emmons

    This is a question better addressed to a C# or VB.NET newsgroup as it is not 
    EID specific. However, here's a quick overview of connecting to any data 
    source:
    
    To access data in a database, you must first establish a connection using an 
    ADO.NET connection object.
    
    OleDbConnection cnADONetConnection = new OleDbConnection();
    cnADONetConnection.ConnectionString = 
    @"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\contacts.mdb";
    cnADONetConnection.Open();
    
    From there you'll issue queries which will return datasets. 
    
    Michael G. Emmons
    http://wpfguru.com
    
    "zoubir" wrote:
    
    > hi,
    > 
    > i have difficulty to fogure out how to connecte to an access database using 
    > perhaps using OleDbConnection, oleDbCommand  etc like I use to do with dotnet 
    > 2.0.
    > 
    > Any help ? thanks
    Tuesday, February 19, 2008 7:09 PM
  • By: zoubir

    Thank you, Michael for your help.
    In fact, I didn't add a reference to System.Data.dll in Dotnet 2.0.   That's 
    why I couldn't have Intellisense functionning properly.
    
    Tuesday, February 19, 2008 7:09 PM
  • By: Michael G. Emmons

    LOL. Yeah, that would cause a problem :D.
    
    -MGE
    http://xamlxaml.com
    
    
    "zoubir" <zoubir@discussions.microsoft.com> wrote in message 
    news:3033EB71-F9A4-43CA-AE86-11B2B26DA811@microsoft.com...
    > Thank you, Michael for your help.
    > In fact, I didn't add a reference to System.Data.dll in Dotnet 2.0. 
    > That's
    > why I couldn't have Intellisense functionning properly.
    > 
    
    Tuesday, February 19, 2008 7:09 PM