Click here to Skip to main content
15,895,256 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
I have developed a windows application. My development environment is win7, office2007, C#, VS2010, Winforms. My application stores data in MS Access.

Is there any way with which i can create a connection string based on MS Access version present in PC?
Posted
Comments
ZurdoDev 16-Jan-14 9:59am    
Yes, but what do you mean? Have you looked at connectionstrings.com?
markand911 17-Jan-14 1:13am    
RyanDev, I mean when i install my application in any windows machine, my application should work smoothly by connection to any version of MS Access. also it should work with any Oledb Driver installed in the PC. How to implement such scenario in C#.net
ZurdoDev 17-Jan-14 7:15am    
It sounds like you need to build an option for them to pick an ODBC connection. Or perhaps, you can just change the connection string.

1 solution

C#
string constr = "Data Source =" + strPath + "\YourDBName.mdb;Provider = Microsoft.Jet.OLEDB.4.0;"

Happy Coding!
:)
 
Share this answer
 
Comments
markand911 17-Jan-14 1:12am    
Thanks Aarti. what i mean is how to decide what data provider i have to use. Whether to use Microsoft.Jet.OLEDB 4.0 or Microsoft.ACE.OLEDB 12.0 or something else. This also depends on which driver is installed in the PC.

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