出现这样的警告:"failed getting Rowset(s) from current data source"!高手指教

解决方案 »

  1.   

    建立一个模块Option ExplicitDeclare Function SendMessage Lib "user32" Alias "SendMessageA" ( _
        ByVal hWnd As Long, _
        ByVal wMsg As Long, _
        ByVal wParam As Long, _
        ByVal lParam As String) As Long
    Declare Function SHGetPathFromIDList Lib "shell32.dll" Alias "SHGetPathFromIDListA" ( _
        ByVal pidl As Long, _
        ByVal pszPath As String) As Long
    Declare Function SHBrowseForFolder Lib "shell32.dll" Alias "SHBrowseForFolderA" ( _
        lpBrowseInfo As BROWSEINFO) As Long
    Type BROWSEINFO
        hOwner As Long
        pidlRoot As Long
        pszDisplayName As String
        lpszTitle As String
        ulFlags As Long
        lpfnCallback As Long
        lParam As Long
        iImage As Long
    End TypePrivate Const BIF_RETURNONLYFSDIRS = &H1
    Private Const BIF_DONTGOBELOWDOMAIN = &H2Dim xStartPath As StringFunction SelectDir(Optional StartPath As String, Optional Titel As String) As String
        Dim iBROWSEINFO As BROWSEINFO
        With iBROWSEINFO
            .lpszTitle = IIf(Len(Titel), Titel, "ÇëÑ¡ÔñÎļþ¼Ð")
            .ulFlags = BIF_RETURNONLYFSDIRS Or BIF_DONTGOBELOWDOMAIN
            If Len(StartPath) Then
            xStartPath = StartPath & vbNullChar
            .lpfnCallback = GetAddressOf(AddressOf CallBack)
            End If
        End With
        Dim xPath As String, NoErr As Long: xPath = Space$(512)
        NoErr = SHGetPathFromIDList(SHBrowseForFolder(iBROWSEINFO), xPath)
        SelectDir = IIf(NoErr, Left$(xPath, InStr(xPath, Chr(0)) - 1), "")
    End FunctionFunction GetAddressOf(Address As Long) As Long
        GetAddressOf = Address
    End FunctionFunction CallBack(ByVal hWnd As Long, _
                      ByVal Msg As Long, _
                      ByVal pidl As Long, _
                      ByVal pData As Long) As Long
        Select Case Msg
            Case 1
                Call SendMessage(hWnd, 1126, 1, xStartPath)
            Case 2
                Dim sDir As String * 64, tmp As Long
                tmp = SHGetPathFromIDList(pidl, sDir)
                If tmp = 1 Then SendMessage hWnd, 1124, 0, sDir
        End Select
    End Function
    Public Function mkSubDir(ByVal sDirPath As String) As Boolean
        On Error GoTo errHandle
        Dim astr() As String
        Dim i As Long
        Dim sTmpPath As String
        astr = Split(sDirPath, "\")
        sTmpPath = astr(0)
        For i = 1 To UBound(astr)
            sTmpPath = sTmpPath & "\" & astr(i)
            If Dir(sTmpPath, vbDirectory) = "" Then MkDir sTmpPath
        Next
        Erase astr
        mkSubDir = True
        Exit Function
    errHandle:
        mkSubDir = False
    End Function
    Private Sub Command1_Click()
        Dim strDir As String
        strDir = SelectDir("C:\", vbNullString) 
        Caption = strDir
    End Sub
      

  2.   

    1
    点击VB的工程引用
    你会看到一个或多个MicroSoft DataRerport Designer
    把其中一个打勾
    然后再打包安装试试
    2
    查看你的报表连接数据源代码,看是不是默认了为开发机器的数据源
      

  3.   

    最近出来一个快乐报表,我用得还可以www.happyreport.com
      

  4.   

    数据库连接出问题了~~看看你的源程序指定的数据库是不是在你本地机器上的?如果是的话路径改为app.path
      

  5.   

    建议用ADO。把数据集读到报表的客户端。
      

  6.   

    兄弟!向你推荐一个免费报表,杭州出的,帮助资料齐全,官方网站还承诺完全免费,我用过了,还可以。去试试www.happyreport.com