Skip to content

How to access the database over the network

lamasat lamasat

Asked Jan 26, 2014, 1:16 AM EST3 answers
Share
LinkedInX
I have a c #  application installed on your computer first, and the database on the second computer, how can access to the database >>> note ...that the type of database is Access
database

3 Answers

Know the answer? Post it. Somebody with the same question will find it here.

  • Biswa Pujarini Mohapatra
    0
    you can access the database from any server. if you know the database name, username and pasword.

    C#
    public void ConnectToAccess() {     System.Data.OleDb.OleDbConnection conn = new          System.Data.OleDb.OleDbConnection();     // TODO: Modify the connection string and include any     // additional required properties for your database.     conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" +         @"Data source= C:\Documents and Settings\username\" +         @"My Documents\AccessFile.mdb";     try     {         conn.Open();         // Insert code to process data.     }         catch (Exception ex)     {         MessageBox.Show("Failed to connect to data source");     }     finally     {         conn.Close();     } }
    0
  • 0
    Excuse me please clarify this conn.ConnectionString = @"Provider=Microsoft.Jet.OLEDB.4.0;" + @"Data source= C:\Documents and Settings\username\" + @"My Documents\AccessFile.mdb";
    0
  • Biswa Pujarini Mohapatra
    0
    Provider is basically the oledb reference for access DB and datasource means the path/location of your database.

    in your case you have to store your db in a shared location and give that folder necessary permission

    hope it helps
    0