Simple crystal report application

It is very simple crystal report application using access database.

Private Sub Me_Load() Handles Me.Load
If Form1.cboSerialNo.SelectedIndex <> -1 Then
Dim rpt As New CrystalReport1()
Dim myConnection As New OleDb.OleDbConnection()
Dim MyCommand As New OleDb.OleDbCommand()
Dim myDA As New OleDb.OleDbDataAdapter()
Dim myDS As New DataSet1()
Dim tbl As New DataTable
myConnection = New OleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Application.StartupPath & "\GoodsReceipt.mdb")
MyCommand.Connection = myConnection
MyCommand.CommandText = "SELECT C.CustomerName, R.SerialNo, R.ReceiptDate FROM Customers C,ReceiptDetails R WHERE C.CustomerID = R.CustomerID AND R.SerialNo=" & Form1.cboSerialNo.SelectedItem
MyCommand.CommandType = CommandType.Text
myDA.SelectCommand = MyCommand
myDA.Fill(myDS, "Singh") ' because it is dataset.
CrystalReportViewer1.ReportSource = rpt
Catch Excep As Exception
MessageBox.Show(Excep.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
End Try
MessageBox.Show("Serial No. is not selected. Please Select...")
End If
End Sub


No responses found. Be the first to comment...

  • Do not include your name, "with regards" etc in the comment. Write detailed comment, relevant to the topic.
  • No HTML formatting and links to other web sites are allowed.
  • This is a strictly moderated site. Absolutely no spam allowed.
  • Name: