• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 587
  • Last Modified:

Crystal Reports Dynamic Sorting Fields

I'm trying to populate a combobox in via VB code based on the fields in a crystal report. The combobox needs to be populated differently for each report as there are several differnt ones with different fields.

Any ideas anyone?
0
reclusive
Asked:
reclusive
1 Solution
 
JRossi1Commented:
Try this:

        Dim strSQl As String = "SELECT TOP 0 * FROM urTable"     <-------- This selects no records but includes all the fields.  You can change this string depending on what report the user selects.

        Dim ds As DataSet = Database.ExecuteDataset(ConnectionString), CommandType.Text, strSQl)   <------- Create your dataset

        Me.cboFieldList.Items.Clear()

        With ds
            For i As Integer = 0 To ds.Tables(0).Columns.Count - 1
                Me.cboFieldList.Items.Add(ds.Tables(0).Columns(i).ColumnName)
            Next
        End With
0

Featured Post

Hire Technology Freelancers with Gigs

Work with freelancers specializing in everything from database administration to programming, who have proven themselves as experts in their field. Hire the best, collaborate easily, pay securely, and get projects done right.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now