0

我没有收到任何错误,但 datagridview 中没有显示数据。我应该在我的代码中添加什么吗?所以它会显示我需要的数据?

如果 MSG = vbYes 那么 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
4

0 回答 0