Hi,
untill now, I always used Crystal Reports with VS2012, but I'm trying the .rdlc reports now to check it as an alternative.
I would like to fill the report from the code behind, using my own SQL select commands. So, I cannot use the wizard to create and display the report.
However, I guess I can/must use the wizard to create the report (layout, what columns to add, ...).
I'v added a ReportViewer to my windows form, created a new report (Report1.rdlc) and used an SQL connection to fill the data. The report loads with the data.
Now, I used the following code in the form_load event to display the desired records.
The report shows the column names, but no data.
If I uncomment the Msgbox line, it says there are several rows. So, I'm sure the datatable is filled with info
Anybody can help me with this one?
untill now, I always used Crystal Reports with VS2012, but I'm trying the .rdlc reports now to check it as an alternative.
I would like to fill the report from the code behind, using my own SQL select commands. So, I cannot use the wizard to create and display the report.
However, I guess I can/must use the wizard to create the report (layout, what columns to add, ...).
I'v added a ReportViewer to my windows form, created a new report (Report1.rdlc) and used an SQL connection to fill the data. The report loads with the data.
Now, I used the following code in the form_load event to display the desired records.
Code:
Dim connectiestring As String = My.Settings.ConnectieString
Dim objConnection As SqlConnection = New SqlConnection(connectiestring)
Dim objDataSet As DataSet
Dim objEmployeesAdapater As SqlDataAdapter
objConnection.Open()
objDataSet = New DataSet("employees")
objEmployeesAdapater = New SqlDataAdapter("SELECT * FROM tblwerknemers", objConnection)
objEmployeesAdapater.Fill(objDataSet, "tblwerknemers")
objConnection.Close()
'MsgBox(objDataSet.Tables("tblwerknemers").Rows.Count)
Dim rds As ReportDataSource = New ReportDataSource("DataSet1", objDataSet.Tables("tblwerknemers"))
ReportViewer1.LocalReport.DataSources.Add(rds)
Me.ReportViewer1.RefreshReport()
The report shows the column names, but no data.
If I uncomment the Msgbox line, it says there are several rows. So, I'm sure the datatable is filled with info
Anybody can help me with this one?