我用VB6链接ACCESS2003库,但执行到K:行时就出现以下错误提示:不知道哪里出问题,求赐教,谢谢!
    Dim adoRS As New ADODB.Recordset
    Dim strConn As String
    Dim strSQL As String
    Dim strDataFile As String
    Dim strTableName As String
    strDataFile = "D:\test\pad.mdb"
    strTableName = "kset"
    strConn = "Data Source=" & strDataFile & ";Provider=Microsoft.Jet.OLEDB.4.0"
    strSQL = "Select * from " & strTableName
K: adoRS.Open strSQL, strConn
    adoRS.Close
    Set adoRS = Nothing

解决方案 »

  1.   

        Dim adoRS As New ADODB.Recordset 
        dim pConn as ADODB.Connection
        Dim strConn As String 
        Dim strSQL As String 
        Dim strDataFile As String 
        Dim strTableName As String 
            strDataFile = "D:\test\pad.mdb" 
        strTableName = "kset" 
        strConn = "Data Source=" & strDataFile & ";Provider=Microsoft.Jet.OLEDB.4.0" 
        pconn.open connectionstring:=strconn
        strSQL = "Select * from " & strTableName 
    K: adoRS.Open strSQL, strConn 
        adoRS.Close 
        Set adoRS = Nothing 
      

  2.   

    加那语句后出来提示(dim pConn as ADODB.Connection/pconn.open connectionstring:=strconn :实时错误'91':
    对象变量或With块变量未设置。未加此句前,错误提示为:
    实时错误'-2147217911 (80040e09)',不能读取记录;在"kset"上没有读取数据权限
      

  3.   

        Dim adoCN As New ADODB.Connection
        Dim adoRS As New ADODB.Recordset 
        Dim strConn As String 
        Dim strSQL As String 
        Dim strDataFile As String 
        Dim strTableName As String 
        strDataFile = "D:\test\pad.mdb" 
        strTableName = "kset" 
        strConn = "Data Source=" & strDataFile & ";Provider=Microsoft.Jet.OLEDB.4.0"
        adoCN.Open strConn
        strSQL = "Select * from " & strTableName 
    K: adoRS.Open strSQL, adoCN 
        adoRS.Close 
        Set adoRS = Nothing
        adoCN.Close
        Set adoCN = Nothing 
      

  4.   

    我有一个代码,经常使用:
    http://download.csdn.net/source/1498324