回 帖 发 新 帖 刷新版面

主题:请高手指点:

<%@ Page Language="VB" ContentType="text/html" ResponseEncoding="gb2312" %>
<%@Import Namespace="System.Data"%>
<%@Import Namespace="System.Data.OleDb"%>
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>无标题文档</title>
  <script runat=server language="vb">
        
        
dim objConnection as OleDbConnection
objConnection=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("/mdb/mdb.mdb"))
objConnection.Open()



    
        If objConnection.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>

运行时出现下面的错误,请指教。
Compilation Error
Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: BC30188: Declaration expected.

Source Error:



Line 10:         
Line 11: dim objConnection as OleDbConnection
Line 12: objConnection=new OleDbConnection("Provider=Microsoft.Jet.OleDb.4.0;Data Source="+Server.MapPath("/mdb/mdb.mdb"))
Line 13: objConnection.Open()
Line 14:

回复列表 (共2个回复)

沙发

objConnection.Open()

板凳

能具体说一下吗,我是初学的。

我来回复

您尚未登录,请登录后再回复。点此登录或注册