I have developed a form in vb.net to dispaly a report by getting the data from databse using a select query. But the report doesn't show any value but shows some error.
The code is as below
Dim sqlcon As SqlCeConnection, sqlcmd As SqlCeCommand, adp As SqlCeDataAdapter, ds As New DataSet
Dim cmdstr As String
Dim s_ds As New sales_bill_dataset
Dim t As New DataTable("sale_details")
Dim r As DataRow
Try
sqlcon = New SqlCeConnection(My.Settings.connectionstr_val)
sqlcon.Open()
cmdstr = "SELECT sales.order_id, sales.order_date, sales.cust_name, sales.cust_add, sales.cust_phone, sales.total_bill, sales.tax_amt, sales.tax_val, sales.discount_amt, " & _
" sales.disc_val, sales.gross_total, sales.ref, sales_details.order_id AS Expr1, sales_details.prod_id, sales_details.prod_s_price, sales_details.qty, " & _
" sales_details.total_bill AS Expr2, sales_details.disc_amt, sales_details.disc_val AS Expr3, sales_details.tax_amt AS Expr4, sales_details.tax_val AS Expr5, " & _
" sales_details.gross_bill, sales_payment_details.order_id AS Expr6, sales_payment_details.payment_date, sales_payment_details.payment_amt, " & _
" sales_payment_details.payment_option, sales_payment_details.cheque_no, sales_payment_details.dd_no, stock.prod_id AS Expr7, stock.prod_name, " & _
" stock.prod_comp_name, stock.prod_spec, stock.prod_ref, stock.warranty_period, stock.prod_p_price, stock.prod_s_price AS Expr8, stock.qty_stock" & _
" FROM sales INNER JOIN" & _
" sales_details ON sales.order_id = sales_details.order_id INNER JOIN" & _
" sales_payment_details ON sales.order_id = sales_payment_details.order_id INNER JOIN" & _
" stock ON sales_details.prod_id = stock.prod_id" & _
" WHERE sales.order_id = 2"
sqlcmd = New SqlCeCommand(cmdstr, sqlcon)
adp = New SqlCeDataAdapter
adp.SelectCommand = sqlcmd
adp.Fill(ds)
t = s_ds.Tables(0)
For i = 0 To ds.Tables(0).Rows.Count - 1
r = t.NewRow
r(0) = ds.Tables(0).Rows(i).Item(0)
r(1) = FormatDateTime(ds.Tables(0).Rows(i).Item(1), DateFormat.GeneralDate)
For j = 2 To ds.Tables(0).Columns.Count - 1
r(j) = ds.Tables(0).Rows(i).Item(j)
Next
t.Rows.Add(r)
Next
Dim rds As New Microsoft.Reporting.WinForms.ReportDataSource
rds.Name = "Dataset1"
MsgBox(Me.sales_bill_dataset.DataTable1.Rows.Count)
rds.Value = t
With ReportViewer1
.Reset()
.LocalReport.DataSources.Clear()
.LocalReport.ReportPath = "D:\Vb .net Projects\aeon\aeon\sales_bill.rdlc"
.LocalReport.DataSources.Add(rds)
.LocalReport.Refresh()
End With
ReportViewer1.RefreshReport()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Me.DataTable1TableAdapter.Adapter.SelectCommand = sqlcmd
DataTable1TableAdapter.Fill(sales_bill_dataset.DataTable1)
ReportViewer1.RefreshReport()
It will create an error as below
an error occured during local report processing.<br />
An error has occured during report processing dataset1