I am facing a minor challenge in my coding i am trying to generate reports from sql statements.however the method i was using ealier involves making a crystal report using the "Add new item".in the menu and using the wizard until you end up putting the table you want on the crystal report and the column names.....This method is complicated in a situation where you have many tables and you want to generate reports.I want a situation where i can type in any sql statement and get a report without having to use the wizard to put tables and column names on the report.Can any one help . i have the code below and help with how to go about will be appreciated or help with my code.

Sub cryview0()
        Dim rpt As New CrystalReport12() 'The report you created.
        'Dim sql_personnel As String = procesSQL(txtSQL.Text, cmbTableName.Text) '"select * from tendai_table2"
        Dim sql_personnel As String = "select * from tendai_table2"
        Dim dt As New DataTable

        dt = MyFormz.cl_Class.SelectRows(sql_personnel)
        'rpt.SetDataSource(dt)cms_dbDataSe

        rpt.Database.Tables.Item("tendai_table2")

        CrystalReportViewer1.ReportSource = rpt

    End Sub

When i use the code above i get the error:"Property access must assign to the property or use its value."on this line:"rpt.Database.Tables.Item("tendai_table2") "

Any Help

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.