Want to protect your cyber security and still get fast solutions? Ask a secure question today.Go Premium

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 327
  • Last Modified:

datatype mismatch

Hi,
In my database the variable is stored as Type MONEY. I am writing a query to retrieve this information and display it on screen. I keep getting Vb.net error # 13( unable to cast object of type'ABODB.internalfield to type system.IConvertible'.

I am sing visualstudio 2005 and language vb.net.

I tried using convert.todecimal and it doesnt work.

here is a snipet:
Dim test As Decimal
test = Convert.ToDecimal(RSTransferCashierPayment("current_bill"))
MsgBox(test)
0
operationsbze
Asked:
operationsbze
  • 3
  • 2
  • 2
1 Solution
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
only 20 points?never mind try this if you are using sql server

Dim cash As Data.SqlTypes.SqlMoney
Dim tet As Double

cash = sqlDataReader.GetSqlMoney(MyColumnIndex)
dbl = cash.ToDouble()
0
 
John (Yiannis) ToutountzoglouInstructor Multiengine PilotCommented:
sorry
Dim cash As Data.SqlTypes.SqlMoney
Dim tet As Double

cash = sqlDataReader.GetSqlMoney(MyColumnIndex)
test = cash.ToDouble()
0
 
operationsbzeAuthor Commented:
ok maybe its more difficult than 20 right? :)

i am not getting the sqldatareader..... I used adodb for my recordset.
0
Concerto's Cloud Advisory Services

Want to avoid the missteps to gaining all the benefits of the cloud? Learn more about the different assessment options from our Cloud Advisory team.

 
cyberkiwiCommented:
Try the old way

test = CDec(RSTransferCashierPayment("current_bill"))

Since it appears you are using ADODB not ADO.Net
0
 
operationsbzeAuthor Commented:
it says ADODB.field cannot be converted to decimal.
0
 
cyberkiwiCommented:
Hmm.. try this

test = CDec(RSTransferCashierPayment("current_bill").Value)

There appears to be no 'default' property for ADODB in vb.net
0
 
operationsbzeAuthor Commented:
Thanks.
0

Featured Post

Free Tool: Subnet Calculator

The subnet calculator helps you design networks by taking an IP address and network mask and returning information such as network, broadcast address, and host range.

One of a set of tools we're offering as a way of saying thank you for being a part of the community.

  • 3
  • 2
  • 2
Tackle projects and never again get stuck behind a technical roadblock.
Join Now