Hi Everyone:
I am trying to print my voucher data but its giving above mentioned error.I am very new in this field and tried several time to solved but failed.If any one can help me i will be thankful. Here is my code:
Code:
Try
            Cursor = Cursors.WaitCursor
            Timer1.Enabled = True
            Dim rpt As New rptVoucher
            Dim myConnection As SqlConnection
            Dim MyCommand As New SqlCommand()
            Dim myDA As New SqlDataAdapter()
            Dim myDS As New DataSet3
            myConnection = New SqlConnection(cs)
            MyCommand.Connection = myConnection
            MyCommand.CommandText = "SELECT Pettycash.ID, Pettycash.Pettycashno,Pettycash.Date, Pettycash.Accountno, Pettycash.Accountname, Pettycash.Amount, Pettycash_Details.VD_ID,Pettycash_Details.Accountname, Pettycash_Details.AccountNo, Pettycash_Details.Billref, Pettycash_Details.Narration, Pettycash_Details.Amount FROM Pettycash INNER JOIN Pettycash_Details ON Pettycash.ID = Pettycash_Details.VoucherID  where Pettycashno='" & txtVoucherNo.Text & "'"
            MyCommand.CommandType = CommandType.Text
            myDA.SelectCommand = MyCommand
            myDA.Fill(myDS, "Pettycash")
            myDA.Fill(myDS, "Pettycash_Details")
            rpt.SetDataSource(myDS)
            frmReport.CrystalReportViewer1.ReportSource = rpt
            frmReport.ShowDialog()
        Catch ex As Exception
            MessageBox.Show(ex.Message, "Error", MessageBoxButtons.OK, MessageBoxIcon.Error)
        End Try
Name:  mJ38h.jpg
Views: 393
Size:  34.0 KB
Name:  TwKzW.png
Views: 338
Size:  8.3 KB