您的位置:首页 > 编程语言 > ASP

aspdotnet connection Sql server

2005-05-27 16:20 260 查看
<%@ Page Language="vb" %><%@ Import Namespace = "System.Data" %><%@ Import Namespace = "System.Data.SQL" %><html>  <head>  <script runat=server>       Sub Page_Load(ByVal Sender As Object, ByVal e As EventArgs)              'On Error Resume Next               Dim cn           As SQLConnection              cn = New SQLConnection("server=localhost;uid=sa;pwd=;database=pubs;")              cn.Open()              If cn.State = 1 Then                     lblReturnCode.Text = "The Connection State is: " & cn.State & " - Connection Succeeded"              Else                     lblReturnCode.Text = "The Connection State is: " & cn.State & " - Connection Failed"              End If        End Sub  </script>  </head>  <body>       <asp:Label id="lblReturnCode" Runat=server />  </body></html>
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息