Click here to Skip to main content
15,894,180 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
i'm using vb 2010 ultimate c#.
i can't find this provider Microsof Jet 4.0 ILE DB Provider
i tried to connect access db with my project but i have problem using this OleDbDataAdapter

how can i do it?
Posted
Updated 30-Dec-12 6:25am
v2
Comments
Zoltán Zörgő 30-Dec-12 12:43pm    
You can't find, and you have problems are not very informative... Could you please post the few rows of code where you try to establish the connection? Btw: there is nothing like "vb 2010 ultimate c#"... Either VB.
Member 8475480 30-Dec-12 15:50pm    
sorry i meen vs

There are two ways to connect to an Access database:

1)Visually, with design-time tools.
2)Programmatically.

Programmatically:
include these namespaces in your project:
C#
using System.Data;
using System.Data.OleDb;



and have a example for string connection:
C#
public void Accessdata()
{
    System.Data.OleDb.OleDbConnection conn = 
                                     new System.Data.OleDb.OleDbConnection();

    conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +
        @"Data source= C:\Documents and Settings\username\" +
        @"My Documents\AccessFile.mdb"; // connection string 
    try
    {
        conn.Open();
        // Insert code for operations.
    }
        catch (Exception ex)
    {
        MessageBox.Show("Failed to connect to data source");
    }
    finally
    {
        conn.Close();
    }


Visually, with design-time tools

Creating Connections to Access Databases[^]
 
Share this answer
 
Comments
Member 8475480 30-Dec-12 15:51pm    
thanks this was helpfull
working on it
Abhishek Pant 30-Dec-12 15:54pm    
If helpful dont forget to vote and accept the answer so that If can help others when they search
maybe you are saying something like this..

Provider=Microsoft.Jet.OLEDB.4.0;Data Source= 'your database path.
 
Share this answer
 
Comments
Member 8475480 30-Dec-12 15:51pm    
thanks this was helpfull
Supposing you need only the proper connection string syntax, look around here: http://www.connectionstrings.com/access-2007[^].

Start with this short tutorial: http://www.dscripts.net/2009/01/20/connect-to-microsoft-access-mdb-database-using-csharp/

Here is a screencast in this topic: http://www.youtube.com/watch?v=uw9vVvgqVMk[^]
 
Share this answer
 
Comments
Member 8475480 30-Dec-12 15:50pm    
thanks this was helpfull

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900