Solved

datatype mismatch

Posted on 2010-08-16
7
286 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
Complete VMware vSphere® ESX(i) & Hyper-V Backup

Capture your entire system, including the host, with patented disk imaging integrated with VMware VADP / Microsoft VSS and RCT. RTOs is as low as 15 seconds with Acronis Active Restore™. You can enjoy unlimited P2V/V2V migrations from any source (even from a different hypervisor)

 
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

Free Tool: ZipGrep

ZipGrep is a utility that can list and search zip (.war, .ear, .jar, etc) archives for text patterns, without the need to extract the archive's contents.

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

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
VB.Net Tranfer data between to VB.Net apps 8 40
Create a datatable in vb.net dynamically 1 24
FInd Image Control Gridview 3 23
DataGridView / get bound table name? 8 28
The ECB site provides FX rates for major currencies since its inception in 1999 in the form of an XML feed. The files have the following format (reducted for brevity) (CODE) There are three files available HERE (http://www.ecb.europa.eu/stats/exch…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
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…
I've attached the XLSM Excel spreadsheet I used in the video and also text files containing the macros used below. https://filedb.experts-exchange.com/incoming/2017/03_w12/1151775/Permutations.txt https://filedb.experts-exchange.com/incoming/201…

828 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