ADO.NET SQL Server Connection
You can connect your VB.Net application to data in a SQL Server database using the Microsoft .NET Framework Data Provider for SQL Server. The first step in a VB.Net application is to create an instance of the Server object and to establish its connection to an instance of SQL Server.
The SqlConnection Object is Handling the part of physical communication between the application and the SQL Server Database. An instance of the SqlConnection class in .NET Framework is supported the Data Provider for SQL Server Database. The SqlConnection instance takes Connection String as argument and pass the value to the Constructor statement. When the connection is established , SQL Commands may be executed, with the help of the Connection Object, to retrieve or manipulate data in the database. Once the Database activities over , Connection should be closed and release the database resources .
Sql Server connection string
If you have a named instance of SQL Server, you'll need to add that as well.
The Close() method in SqlConnection class is used to close the Database Connection. The Close method rolls back any pending transactions and releases the Connection from the SQL Server Database.
A Sample VB.Net Program that connect SQL Server using connection string.
Connecting to SQL Server using windows authentication
Trusted Connection from a CE device
This will only work on a CE device
Connect via an IP address
1433 is the default port for SQL Server.
A sample VB.Net program that demonstrate how to execute sql statement and read data from SQL server.
A sample VB.Net program that perform Data Manipulation tasks like Insert , Update , Delete etc. also perform by the ExecuteNonQuery() of SqlCommand Object.