ahmed salah

ahmed salah

  • NA
  • 85
  • 59k

how to change the location of database file dynamically in a

Mar 28 2017 12:20 PM

I work in windows form application works in c# visual studio 2015 connect to database access 2007

my connection as bellow

 
  1. public static string fileName = @"\\192.168.1.30\data\accessqr.accdb";  
  2.   
  3. public string connection = string.Format("Provider=Microsoft.ACE.OLEDB.12.0;" + "Data Source={0}", fileName);  

it working without any problem

but if i need to move database access file accessqr.accdb in another network or another place

may be no ip 192.168.1.30 available or no drive D: available so that

how to make connection dynamic to accept any network ?

so that i need my connection dynamic and is suitable to any place

what i do ?


Answers (2)