Solved

datatype mismatch

Posted on 2010-08-16
7
274 Views
Last Modified: 2012-05-10
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
Comment
Question by:operationsbze
  • 3
  • 2
  • 2
7 Comments
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
Comment Utility
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
 
LVL 18

Expert Comment

by:John (Yiannis) Toutountzoglou
Comment Utility
sorry
Dim cash As Data.SqlTypes.SqlMoney
Dim tet As Double

cash = sqlDataReader.GetSqlMoney(MyColumnIndex)
test = cash.ToDouble()
0
 

Author Comment

by:operationsbze
Comment Utility
ok maybe its more difficult than 20 right? :)

i am not getting the sqldatareader..... I used adodb for my recordset.
0
Better Security Awareness With Threat Intelligence

See how one of the leading financial services organizations uses Recorded Future as part of a holistic threat intelligence program to promote security awareness and proactively and efficiently identify threats.

 
LVL 58

Expert Comment

by:cyberkiwi
Comment Utility
Try the old way

test = CDec(RSTransferCashierPayment("current_bill"))

Since it appears you are using ADODB not ADO.Net
0
 

Author Comment

by:operationsbze
Comment Utility
it says ADODB.field cannot be converted to decimal.
0
 
LVL 58

Accepted Solution

by:
cyberkiwi earned 50 total points
Comment Utility
Hmm.. try this

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

There appears to be no 'default' property for ADODB in vb.net
0
 

Author Closing Comment

by:operationsbze
Comment Utility
Thanks.
0

Featured Post

IT, Stop Being Called Into Every Meeting

Highfive is so simple that setting up every meeting room takes just minutes and every employee will be able to start or join a call from any room with ease. Never be called into a meeting just to get it started again. This is how video conferencing should work!

Join & Write a Comment

Can I legally transfer my OEM version of Windows to another PC?  (AKA - Can I put a new systemboard in my OEM PC?) Few of us are both IT and legal experts but we all have our own views of Microsoft's licensing rules and how they apply.  There are…
If you have done a reformat of your hard drive and proceeded to do a successful Windows XP installation, you may notice that a choice between two operating systems when you start up the machine. Here is how to get rid of this: Click Start Clic…
This video gives you a great overview about bandwidth monitoring with SNMP and WMI with our network monitoring solution PRTG Network Monitor (https://www.paessler.com/prtg). If you're looking for how to monitor bandwidth using netflow or packet s…
This demo shows you how to set up the containerized NetScaler CPX with NetScaler Management and Analytics System in a non-routable Mesos/Marathon environment for use with Micro-Services applications.

744 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

17 Experts available now in Live!

Get 1:1 Help Now