Hi to all,

I want to pass the below statement to a report... Kindly help me how to do it ...

select a.po_number,a.mr_number,b.item_code,c.item_desc,
b.qty,b.rate from po_head a,po_detail b,item_master c
where a.mr_number=b.mr_number and b.item_code=c.item_code and
po_number = ' & combopo.text & ';

kindly help...

Recommended Answers

Dim sqlcon As New SqlConnection("put your connection string here")
        sqlcon.Open()
        Dim sqlcom As New SqlCommand(String.Format("select a.po_number,a.mr_number,b.item_code,c.item_desc,b.qty,b.rate from po_head a,po_detail b, item_master(c) where(a.mr_number = b.mr_number And b.item_code = c.item_code and po_number = {0}", combopo.Text, sqlcon))
        Dim sqladapter As New SqlDataAdapter(sqlcom)
        Dim sqldt As New DataTable
        sqladapter.Fill(sqldt)

        Dim crystalreport …
Jump to Post

All 3 Replies

Dim sqlcon As New SqlConnection("put your connection string here")
        sqlcon.Open()
        Dim sqlcom As New SqlCommand(String.Format("select a.po_number,a.mr_number,b.item_code,c.item_desc,b.qty,b.rate from po_head a,po_detail b, item_master(c) where(a.mr_number = b.mr_number And b.item_code = c.item_code and po_number = {0}", combopo.Text, sqlcon))
        Dim sqladapter As New SqlDataAdapter(sqlcom)
        Dim sqldt As New DataTable
        sqladapter.Fill(sqldt)

        Dim crystalreport As New ReportDocument
        crystalreport.Load("put your report path here")
        crystalreport.SetDataSource(sqldt)
        crystalreport.Refresh()

Type report document is not defined ...

This error is coming ...

its very obvious

1> add reference to CrystalDecisions.Shared & CrystalDecisions.CrystalReports.Engine
2> add the following namespace on the top

Imports CrystalDecisions.Shared
Imports CrystalDecisions.CrystalReports.Engine
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts learning and sharing knowledge.