How to Open a Database Connection in VB.Net

Leave a Comment

The following Example would show how to create and open a connection for a Microsoft SQL Server databases.

OpenSqlConnection.aspx
<%@ Import Namespace="System.Data.SqlClient" %>
<Script Runat="Server">
Sub Page_Load
Dim conNorthwind As SqlConnection
conNorthwind=NewSqlConnection("Server=localhost;uid=sa;pwd=secret;database= Northwind" )
conPubs. Open ()
End Sub
</Script>

0 comments:

Post a Comment