Solved

datatype mismatch

Posted on 2010-08-16
7
294 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 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
VIDEO: THE CONCERTO CLOUD FOR HEALTHCARE

Modern healthcare requires a modern cloud. View this brief video to understand how the Concerto Cloud for Healthcare can help your organization.

 
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 50 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

PeopleSoft Has Never Been Easier

PeopleSoft Adoption Made Smooth & Simple!

On-The-Job Training Is made Intuitive & Easy With WalkMe's On-Screen Guidance Tool.  Claim Your Free WalkMe Account Now

Question has a verified solution.

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

If you need to start windows update installation remotely or as a scheduled task you will find this very helpful.
When you start your Windows 10 PC and got an "Operating system not found" error or just saw  "Auto repair for startup" or a blinking cursor with black screen. A loop for Auto repair will start but fix nothing.  You will be panic as there are no back…
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…
In this brief tutorial Pawel from AdRem Software explains how you can quickly find out which services are running on your network, or what are the IP addresses of servers responsible for each service. Software used is freeware NetCrunch Tools (https…

623 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