是否执行了cnn.open 
连接没有打开。

解决方案 »

  1.   

    群子:是执行了CNN.OPEN啊,应该怎么改?请指教.
      

  2.   

    你的cnn定义了吗??并且cnn是否打开???
      

  3.   

    你首先要定义一下Cnn然后打开连接:
    Cnn = Server.CreateObject("ADODB.Connection")
    然后打开数据库引擎:
    StrCnn$ = "你的数据库类型、密码和数据库名称"
    //格式请参看一些书籍我有ASP的类似格式不知能够套用到vb中
    Cnn.Open(StrCnn)
    ......
      

  4.   

    多谢各位,可我的CNN已经打开了,在模块那一段中设置了,如下:
    Option Explicit
    Public cnn As ADODB.Connection
    Public Rs As New ADODB.Recordset
    Function FunSqlLink() As IntegerDim LocalPath As String
    Dim cnn As ADODB.ConnectionLocalPath = App.Path & "\"
    On Error GoTo InitializeError
      Set cnn = New ADODB.Connection
      cnn.Open ("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & LocalPath & "quantity.mdb;Persist Security Info=False;jet oledb")
      FunSqlLink = 1
    Exit FunctionInitializeError:
      FunSqlLink = 0
    End FunctionFunction FunSqlClose() As Integer
    On Error GoTo CloseError
      Rs.Close
      Set Rs = Nothing
      cnn.Close
      Set cnn = Nothing
      FunSqlClose = 1Exit FunctionCloseError
      FunSqlClose = 0
    End Function
    有什么问题吗?请帮忙看一下.一个礼拜了还未解决,很惨.谢谢了.