Q&A

Q1:If I want to connect to a data source other than Jet, how do I know what connect string to use?
A1: Not only is different connection information available for different types of data sources, but also for different versions of different data sources. The best way of determining the connection string is to consult the documentation for the data source to which you want to attach.
Q2:What if I don't know where the database will be at runtime?
A2: For file-based data sources such as Jet, you can add an Open File dialog control to the form and let the user browse and select the database. Then, concatenate the file with the rest of the connection information (such as the provider string).

Get Sams Teach Yourself C#™ in 24 Hours now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.