<%@ Import Namespace="System.Data"%>
<%@ Import Namespace="System.Data.SqlClient"%>
<%@ Page Language="VB" %>
<script runat="server">
Dim objConn As SqlConnection
Dim objCmd As SqlCommand
Sub Page_Load(sender As Object, e As EventArgs)
Dim strConnString As String
strConnString = "Server=localhost;Uid=sa;PASSWORD=;database=mydatabase;Max Pool Size=400;Connect Timeout=600;"
objConn = New SqlConnection(strConnString)
objConn.Open()
If objConn.State = ConnectionState.Open Then
Me.lblText.Text = "SQL Server Connected"
Else
Me.lblText.Text = "SQL Server Connect Failed"
End IF
End Sub
Sub Page_UnLoad()
objConn.Close()
objConn = Nothing
End Sub
</script>
<html>
<head>
<title>ThaiCreate.Com ASP.NET - SQL Server</title>
</head>
<body>
<form id="form1" runat="server">
<asp:Label id="lblText" runat="server"></asp:Label>
</form>
</body>
</html>
Dim objcon As SqlConnection
Dim objcmd As SqlCommand
Sub Page_Load(ByVal Send As Object, ByVal e As EventArgs)
Dim strcon As String
strcon = "Server=SOLUNIC_PLANER; Uid=sa; PASSWORD=;database=tester; Max Pool Size=400; Connect Timeout=600;"
objcon = New SqlConnection(strcon)
objcon.Open()
If objcon.State = ConnectionState.Open Then
Me.lblText.Text = "connected"
Else
Me.lblText.Text = "fail"
End If
End Sub
Sub Page_UnLoad()
objcon.Close()
objcon = Nothing
End Sub
</script>
<%@ Page Language="VB" AutoEventWireup="false" CodeFile="tester.aspx.vb" Inherits="_Default" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<script runat="server">
</script>
<html xmlns="http://www.w3.org/1999/xhtml">
<head runat="server">
<title>tester Page</title>
</head>
<body bgcolor="gray">