More details are needed here.
If you want to connect a control to the database, say a DataGrid, then a wizard will be presented when creating the control, and you wouldn’t have to write any code to create the database connection.
If you want to connect by code, then you would write some code like this (this example shows a connection to an express edition server):
Dim conString As String = “Data Source=YourMachine\SQLEXPRESS;Initial Catalog=YourDatabase;User ID=YourUserID;Password=YourPassword”
Dim conn As SqlConnection
conn = New SqlConnection
conn.ConnectionString = conString
If conn.State = Data.ConnectionState.Open Then