Databases Reference
In-Depth Information
Figure 5-1. Connection strings
Making the Connection
Let's first look at how to connect to a SQL Database instance using ADO.NET. Fire up an instance of Visual Studio
2010, and create a new C# Windows Forms application. Then, follow these steps:
1.
Place a button on Form1, and double-click the new button to view its Click event.
2.
Before you place any code in the click event you'll need to declaration to use the
appropriate SQLConnection class:
using System.Data.SqlClient;
 
Search WWH ::




Custom Search