Cant add dataset to report programmatically
Hi!
Im trying to make a report with MicrosoftReportViewer and a dataset programmatically defined and I dont know how to bind each other.
I have defined a dataset which I fill with the result of a sql query to a database and acts as datasource for a datagridview, so I can view in a table in my form the result of the query.
I would like to do a report with the same result but I cant find anywhere how to do it. Ive found examples about doing reports and datasets with wizards, but it doesnt help me because my dataset is generated at run time.
Ive tried adding a report to my project but I cant add the columns to it because my dataset doesnt appear in the solution explorer.
This is the code that fills the datagridview
Code:
Dim das1 As New DataSet
Dim dap1 As New OleDbDataAdapter
Dim cmd1 As New OleDbCommand
cmd1.Connection = connection
Dim sqlcommand As String = "SELECT ... FROM ... WHERE ... "
cmd1.CommandText = sqlcommand
dap1.SelectCommand = cmd1
dap1.Fill(das1)
dap1.Fill(das1, "Customers")
DataGridView1.DataSource = das1
DataGridView1.DataMember = "Customers"
I want to generate a report with the same table I see in the datagridview.
Could anyone help me?
Thnks!!