0

I didn't get any error but there is no data that is displaying in the datagridview . Is there anything that i should add in my codes ? so it will display the data that i need ?

If MSG = vbYes Then Timer1.Enabled = True

        Me.stpLoadBar.Value = 0

        Me.stpLoadBar.Value = increment
        'Me.lstSearch.Items.Clear()
        If Me.txtRefFR.Text = "" Or Me.txtRefTO.Text = "" Then
            MessageBox.Show("Check Number is required and must not be blank.")
            'Me.cmdPrint.Enabled = False
        ElseIf CInt(Me.txtRefFR.Text) > CInt(Me.txtRefTO.Text) Then
            MessageBox.Show("Check Number From must not be greater than Check Number To.")
            Me.txtRefFR.Text = ""
            Me.txtRefTO.Text = ""
        Else
            If Me.chkEnterBill.Checked = True Then
                strSelect = "SELECT billpaymentcheckline.Txnnumber, billpaymentcheckline.payeeentityreffullname, billpaymentcheckline.txndate, billpaymentcheckline.bankaccountreffullname , billexpenseline.memo " _
               & ", billpaymentcheckline.amount, billpaymentcheckline.refnumber, billpaymentcheckline.appliedtotxnrefnumber, billpaymentcheckline.appliedtotxntxndate, billpaymentcheckline.appliedtotxnamount from billpaymentcheckline INNER JOIN BillExpenseLine ON (billpaymentcheckline.appliedtotxnrefnumber = billexpenseline.refnumber)  WHERE" _
               & " billpaymentcheckline.refnumber BETWEEN '" & CInt(Me.txtRefFR.Text) & "' AND '" & CInt(Me.txtRefTO.Text) & "' AND" _
               & " billpaymentcheckline.bankaccountreffullname='" & Me.lblBankName.Text & "'ORDER BY billpaymentcheckline.refnumber"
                Try

                    Dim conChk As New Odbc.OdbcConnection(My.Settings.strConn)
                    conChk.Open()

                    Dim cmdChk As New Odbc.OdbcCommand(strSelect, conChk)
                    cmdChk.CommandType = CommandType.Text

                    Dim daChk As New Odbc.OdbcDataAdapter(cmdChk)
                    daChk.Fill(dsCVI, "tblvoucheritem")

                    With dgvCV
                        .RowsDefaultCellStyle.BackColor = Color.White
                        .AlternatingRowsDefaultCellStyle.BackColor = Color.DeepSkyBlue
                        .DataSource = dsCVI.Tables("tblvoucheritem")
                        .ReadOnly = True
                    End With

                    daChk.Dispose()
                    cmdChk.Dispose()
                    conChk.Close()
                    Me.rbCheck.Enabled = True
                    Me.rbCV.Enabled = True

                Catch ex As Exception
                    MessageBox.Show(ex.Message)
                    Me.rbCheck.Enabled = False
                    Me.rbCV.Enabled = False

                Finally

                End Try
                Me.stpLoadBar.Value = 100
Maine
  • 1
  • 1
  • 5
  • What database are you using? Also, you don't need to quote your number values, and you should probably use SQL parameters (which will have the added benefit of having your SQL in a single string). – Zev Spitz Aug 02 '16 at 07:06
  • @ZevSpitz the database that i am using is QODBC – Maine Aug 02 '16 at 07:09
  • If you insist on using string concatenation, at least use string interpolation (`$"text {variable} text"`). Also, VB.NET supports multiline strings. – Zev Spitz Aug 02 '16 at 07:14
  • @ZevSpitz I edit the my first post so you can see the whole syntax for that specific code .. I tried to use the one that you post but im getting an error like this "Expected Lexical Element not Found" – Maine Aug 02 '16 at 07:24

0 Answers0