Go Premium for a chance to win a PS4. Enter to Win

x
?
Solved

datatype mismatch

Posted on 2010-08-16
7
Medium Priority
?
313 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
ID: 33450211
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
ID: 33450222
sorry
Dim cash As Data.SqlTypes.SqlMoney
Dim tet As Double

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

Author Comment

by:operationsbze
ID: 33450273
ok maybe its more difficult than 20 right? :)

i am not getting the sqldatareader..... I used adodb for my recordset.
0
Industry Leaders: We Want Your Opinion!

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

 
LVL 58

Expert Comment

by:cyberkiwi
ID: 33450297
Try the old way

test = CDec(RSTransferCashierPayment("current_bill"))

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

Author Comment

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

Accepted Solution

by:
cyberkiwi earned 200 total points
ID: 33450503
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
ID: 33450517
Thanks.
0

Featured Post

Vote for the Most Valuable Expert

It’s time to recognize experts that go above and beyond with helpful solutions and engagement on site. Choose from the top experts in the Hall of Fame or on the right rail of your favorite topic page. Look for the blue “Nominate” button on their profile to vote.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

It’s quite interesting for me as I worked with Excel using vb.net for some time. Here are some topics which I know want to share with others whom this might help. First of all if you are working with Excel then you need to Download the Following …
Parsing a CSV file is a task that we are confronted with regularly, and although there are a vast number of means to do this, as a newbie, the field can be confusing and the tools can seem complex. A simple solution to parsing a customized CSV fi…
Video by: ITPro.TV
In this episode Don builds upon the troubleshooting techniques by demonstrating how to properly monitor a vSphere deployment to detect problems before they occur. He begins the show using tools found within the vSphere suite as ends the show demonst…
Two types of users will appreciate AOMEI Backupper Pro: 1 - Those with PCIe drives (and haven't found cloning software that works on them). 2 - Those who want a fast clone of their boot drive (no re-boots needed) and it can clone your drive wh…

972 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