hi
i am having a problem in crystal report.
in the combobox1,i have a list of table name.when i select one name ,then all the data in that table will be inserted into the report table and i ll map all those data to the crystal report.after the report is shown ,then the report table will be blanked..now the problem is that when ever i am accessng the crystal report 1st tme,i can view all the data in the selected table from the combobox1.but on subsequent access to crystal report i cant get the all records inserted(means i always get one record less than the actual value).the code i used is something like below:
Private Sub ButtonReport_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
da = New OleDb.OleDbDataAdapter("select * from " & ComboBox1.SelectedItem & "", cn)
ds.Clear()
ds.Reset()
da.Fill(ds)
Dim i As Integer
For i = 0 To ds.Tables(0).Rows.Count - 1
Try
cm = New OleDb.OleDbCommand("insert into report values ( '" & ds.Tables(0).Rows(i)(0) & "','" & ds.Tables(0).Rows(i)(1) & "','" & ds.Tables(0).Rows(i)(2) & "','" & ds.Tables(0).Rows(i)(3) & "','" & ds.Tables(0).Rows(i)(4) & "','" & ds.Tables(0).Rows(i)(5) & "' )", cn)
cm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
Next
Dim frm As New LedgerShow()
frm.CrystalReportViewer1.ReportSource = "E:\Accounts_swt\Accounts\Ledger.rpt"
frm.Update()
frm.Show()
'frm.Update()
frm.Refresh()
ds.Clear()
ds.Reset()
Try
cm = New OleDb.OleDbCommand("delete from report", cn)
cm.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.Message)
End Try
End Sub
thanks in advance..
its urgernt please..
Answers
Know the answer? Post it. Somebody with the same question will find it here.