report

Hi Experts

i have datatable dt2 with fields
part
selling
I have report1.rdlc which has textBox1 and textBox2

how can I run report1 and bind data from dt2
part  in textBox1
and
selling  in textBox1

is that possible ?

Thanks
b001Asked:
Who is Participating?
 
Alfredo Luis Torres SerranoDevelopment Director / DBACommented:
Create the report with a ghost dataset with the fields you want Then do somehitng like

ReportViewer1.Reset()
ReportViewer1.LocalReport.ReportEmbeddedResource = "WindowsApplication1.ReportName.rdlc"
Conn.Open()
adap1 = New System.Data.SqlClient.SqlDataAdapter(YuorSelectQueryhere, Conn)
ds = New System.Data.DataSet()
adap1.Fill(ds, "Wherever")
Conn.Close()
ReportViewer1.LocalReport.DataSources.Clear()
Dim rs As Microsoft.Reporting.WinForms.ReportDataSource = Nothing
rs = New Microsoft.Reporting.WinForms.ReportDataSource("RerortDatasetGhostName", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Add(rs)
ReportViewer1.AutoSize = True
Me.ReportViewer1.RefreshReport()

Hope this help
0
 
CodeCruiserCommented:
You would need to design the report using a dataset first and then populate it with datatable at runtime

http://msdn.microsoft.com/en-us/library/ms252094(v=vs.80).aspx
0
 
Alfredo Luis Torres SerranoDevelopment Director / DBACommented:
Create the report with a ghost dataset with the fields you want Then do somehitng like

StrSql = StrSql + "Señect .........")
ReportViewer1.Reset()
ReportViewer1.LocalReport.ReportEmbeddedResource = "WindowsApplication1.ReportName.rdlc"
Conn.Open()
adap1 = New System.Data.SqlClient.SqlDataAdapter(StrSql, Conn)
ds = New System.Data.DataSet()
adap1.Fill(ds, "Wherever")
Conn.Close()
ReportViewer1.LocalReport.DataSources.Clear()
Dim rs As Microsoft.Reporting.WinForms.ReportDataSource = Nothing
rs = New Microsoft.Reporting.WinForms.ReportDataSource("RerortDatasetGhostName", ds.Tables(0))
ReportViewer1.LocalReport.DataSources.Add(rs)
ReportViewer1.AutoSize = True
Me.ReportViewer1.RefreshReport()

Hope this help


0
Question has a verified solution.

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

All Courses

From novice to tech pro — start learning today.