MySQL Forums
Forum List  »  Quality Assurance

Re: How to connect database in C#
Posted by: MBA Updates
Date: December 30, 2011 12:21AM

1.On the File menu, point to New and then click Project.

2.In the New Project dialog box, click Windows Forms Application, and then click OK.

A new Windows Forms project opens.

3.On the Data menu, click Add New Data Source.

The Data Source Configuration Wizard opens.

4.Click Database and then click Next.

5.Click New Connection.

The Add Connection dialog box opens.

6.In the Add Connection dialog box, if the Data source is not Microsoft SQL Server Compact 3.5 (.NET Framework Data Provider for Microsoft SQL Server Compact 3.5), click Change and select Microsoft SQL Server Compact 3.5 from the Change Data Source dialog box. Click OK.

7.Click the Browse button and locate the Northwind.sdf database.
The default location is drive:\Program Files\Microsoft SQL Server Compact Edition\v 3.5\Samples.

8.Click Test Connection to verify that the connection succeeded, and then click OK to close the dialog box.

9.Click OK to close the dialog box, and then in the Data Source Configuration Wizard, click Next. If prompted to copy the data file to your project, click Yes.

10.On the next page of the wizard, select the Yes, save the connection as check box, and then click Next.

11. On the Choose Your Database Objects page, expand Tables.

12.Select the check box for both Products and Order Details, and then click Finish.A local database file is added to your project. Notice that a NorthwindDataSet object has been added to the Data Sources window.

13.In Solution Explorer, select Northwind.sdf and make sure that the Copy to Output Directory property is set to Copy if newer.

14.On the File menu, click Save All to save your project.


Top MBA Colleges in India
Business School Ranking

Options: ReplyQuote


Subject
Views
Written By
Posted
2066
December 19, 2011 01:46AM
1157
December 19, 2011 08:46PM
1337
March 30, 2012 01:07AM
Re: How to connect database in C#
3220
December 30, 2011 12:21AM


Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.