how to write remote connection in Microsoft Office Access 2007 in c#.net

Posted by Gow.Net under C# on 7/2/2012 | Points: 10 | Views : 1108 | Status : [Member] | Replies : 1
in my windows application i am using Microsoft Office Access 2007 as my data base.i need how to write remote connection in Microsoft Office Access 2007 in c#.net any one help me

gowthaman8870226416


Responses

Posted by: Johnbhatt on: 7/2/2012 [Member] Starter | Points: 25

Up
0
Down
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();
}
}


John Bhatt
Glad to Know, Free to Share.....
http://www.johnbhatt.com

Gow.Net, if this helps please login to Mark As Answer. | Alert Moderator

Login to post response