i am trying to create a crystal report and run it on the fly so far this is where i am can anyone help or point me in the right direction.Any help will be appreciated

Private Function SetupReport(ByRef objCrystalReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument) As System.Boolean
        Dim crTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
        Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
        Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
        Dim aTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim bTable As CrystalDecisions.CrystalReports.Engine.Table
        Dim blnTest As System.Boolean
        Dim strLocation As System.String

        crDatabase = objCrystalReportDocument.Database
        crTables = crDatabase.Tables
        For Each aTable In crTables


            crTableLogOnInfo = aTable.LogOnInfo
            crTableLogOnInfo.ConnectionInfo.UserID = strUID
            crTableLogOnInfo.ConnectionInfo.Password = strPWD
            crTableLogOnInfo.ConnectionInfo.ServerName = strDSN
            crTableLogOnInfo.ConnectionInfo.DatabaseName = strDB



            
            aTable.ApplyLogOnInfo(crTableLogOnInfo)


            aTable.Location = strLocation
            blnTest = aTable.TestConnectivity()

so far this is how far i've gone. iam stil trying to configure and create a crystal report using code.Any Help

Private Function SetupReport(ByRef objCrystalReportDocument As CrystalDecisions.CrystalReports.Engine.ReportDocument) As System.Boolean

        Dim crTableLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo
        Dim crDatabase As CrystalDecisions.CrystalReports.Engine.Database
        Dim crTables As CrystalDecisions.CrystalReports.Engine.Tables
        Dim aTable As CrystalDecisions.CrystalReports.Engine.Table

        Dim blnTest As System.Boolean
        Dim tablename(0) As String
       
        crDatabase = objCrystalReportDocument.Database
        crTables = crDatabase.Tables
        'For Each aTable In crTables

        crTableLogOnInfo = aTable.LogOnInfo
        crTableLogOnInfo.ConnectionInfo.UserID = strUID
        crTableLogOnInfo.ConnectionInfo.Password = strPWD
        crTableLogOnInfo.ConnectionInfo.ServerName = strDSN
        crTableLogOnInfo.ConnectionInfo.DatabaseName = strDB

        tablename(0) = "tendai_table2"
        Dim rpt As New CrystalReport3()
        Dim sql_personnel As String = "select * from tendai_table2"

        aTable.ApplyLogOnInfo(crTableLogOnInfo)

        blnTest = aTable.TestConnectivity()

        CrystalReportViewer1.ReportSource = myreport

        Return True

    End Function
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.