Simple Connection For Visual Basic 2010 with SQL Server 2008 R2 Database For Beginner

I have go tired to connetion to SQL Server. But I have searcing on google , i finding simple code for connection to SQL Server Data Base.

Here The Code :

 Public Conn As New SqlConnection("Integrated Security=true; " & _
                                    "Initial Catalog=yourdatabase;" & _
                                     "Data Source=.\SQLEXPRESS")

You Can save it on the module

little explanation :

Public conn As New SqlConnection = Declarated " CONN  " for called database 

Initial Catalog yourdatabase = Select yourdatabase here

 Data Source=.\SQLEXPRESS = Database SQL server connection