0
我想獲取數量數據並將其轉換爲十進制數。在QODBC中獲取數據並將其轉換爲十進制數
我遇到了一個問題,即有十進制數的數值正在四捨五入。例如:我需要的金額是amount = 123.5
,但我得到的價值是124
。
If Me.chkEnterBill.Checked = True Then
Dim amount As Decimal
amount = CDec(Val("amount"))
strSelect = "SELECT Txnnumber, payeeentityreffullname, txndate, bankaccountreffullname" _
& ",amount, refnumber, appliedtotxnrefnumber, appliedtotxntxndate, appliedtotxnamount, memo from billpaymentcheckline WHERE" _
& " refnumber BETWEEN '" & CInt(Me.txtRefFR.Text) & "' AND '" & CInt(Me.txtRefTO.Text) & "' AND" _
& " bankaccountreffullname='" & Me.lblBankName.Text & "'ORDER BY 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
我的數據庫是QODBC – Maine
@Maine你有沒有檢查你的數據庫?這是我要解決問題的第一件事情。如果問題與數據類型,則模式需要改變。通常由DBA完成。讓我知道你發現了什麼。 – objectNotFound