This is a migrated thread and some comments may be shown as answers.

Connect String and Bind

3 Answers 78 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
Dav
Top achievements
Rank 1
Dav asked on 12 Aug 2011, 03:43 PM
I worked for 1 year with XtraReport of DevExpress, but I've only had problems, very unstable, unfriendly, simple things end up being very complicated. The designer has many many many bugs and work with this has been torture. I can write 50 or 60 lines of problems encountered with the XtraReport.

For 5 days I have been testing the Telerik.Reporting and I'm happy, we are seriously evaluating purchase, ease of use is incredible. I really like the ReportViewer is simple but very powerful, I have to write too much code to use.

Let me clarify, I develop applications for Windows Forms.

I have 2 basic questions:

1.- I can use my connection object instead of the connection string?
2.- How I can bind a datable to the report. I've tried in many ways without success

Dim oTabla As New DataTable
       oTabla.Columns.Add("F1")
       oTabla.Columns.Add("F2")
       oTabla.Columns.Add("F3")
       oTabla.Columns.Add("F4")
 
       Dim objectDataSource3 As New Telerik.Reporting.ObjectDataSource()
       Dim oReport3 As New ReportNew1
       oReport3.DataSource = oTabla
 
       Dim oFrm As New FrmReportViewer
       oFrm.ReportViewer1.Report = oReport3
       oFrm.ReportViewer1.RefreshReport()
       oFrm.ShowDialog()      

Thanks you.

Wonderful product.!!

David.


3 Answers, 1 is accepted

Sort by
0
Peter
Telerik team
answered on 12 Aug 2011, 05:22 PM
Hello Dav,

Thank you for the kind words - much appreciated.

Up to your questions, the ObjectDataSource component supports any component that implements IListSource, including DataTableDataSet and DataView. For sample code check out How to: Bind to a DataTable help article.

About the connection string, we are not sure we have understood your requirement, thus we will appreciate if you elaborate further on your connection object.

All the best,
Peter
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

0
Dav
Top achievements
Rank 1
answered on 12 Aug 2011, 05:40 PM
Hi Peter.

I have tried but not working......  You can check my example

Dim oTabla As New DataTable
       oTabla.Columns.Add("F1")
       oTabla.Columns.Add("F2")
       oTabla.Columns.Add("F3")
       oTabla.Columns.Add("F4")
 
       Dim objectDataSource3 As New Telerik.Reporting.ObjectDataSource()
       Dim oReport3 As New ReportNew1
       oReport3.DataSource = oTabla
 
       Dim oFrm As New FrmReportViewer
       oFrm.ReportViewer1.Report = oReport3
       oFrm.ReportViewer1.RefreshReport()
       oFrm.ShowDialog() 

I have 4 textbox in the report and I have set the Value property to the datatable field name... as follows:  =Fields.F1   ..... =Fields.F4

Do I have wrong in my code??

Thanks you

David
0
Peter
Telerik team
answered on 15 Aug 2011, 02:06 PM
Hello Dav,

In the provided code snippet you set up DataTable definition however we don't see how you have populated the DataTable with data. Additionally you have created an instance of ObjectDataSource component but you don't utilize it. Check out the following code snippet that illustrates how to bind to DataTable:

' Creating and configuring the ObjectDataSource component:
Dim objectDataSource As New Telerik.Reporting.ObjectDataSource()
objectDataSource.DataSource = GetData() ' GetData returns a DataTable
 
'Creating a new report
Dim report As New MyReport()
 
' Assigning the ObjectDataSource component to the DataSource property of the report.
report.DataSource = objectDataSource
 
' Assigning the report to the report viewer.
Me.reportViewer1.Report = report

Still we are not sure about you scenario. Thus if you experience any further difficulties we will appreciate if you elaborate further on your requirements.

You may find useful the following help resources:
Regards,
Peter
the Telerik team

Explore the entire Telerik portfolio by downloading the Ultimate Collection trial package. Get now >>

Tags
General Discussions
Asked by
Dav
Top achievements
Rank 1
Answers by
Peter
Telerik team
Dav
Top achievements
Rank 1
Share this question
or