Solved

reader smallint casting

Posted on 2007-11-19
3
484 Views
Last Modified: 2008-02-07
I am trying to do this:

        Dim level As Integer = reader.GetInt32(4)

I keep getting an error that I cannot cast that .....
The value in reader (4) is a small int.

What do I use to get the small int and what do I cast it to?

thanks
0
Comment
Question by:BobCSD
  • 2
3 Comments
 
LVL 16

Accepted Solution

by:
McExp earned 500 total points
ID: 20316558
This should work for you:-
Dim level As Integer = reader.GetInt16(4)

Open in new window

0
 
LVL 1

Author Comment

by:BobCSD
ID: 20316671
that worked....

But so did the GetValue(4) that I tried just prior.

Which should I use, and why?
thanks!
0
 
LVL 16

Expert Comment

by:McExp
ID: 20321594
using GetValue returns an object you will have to cast to an int16.
using GetInt16 returns an int16 you will not have to cast.
0

Featured Post

How to improve team productivity

Quip adds documents, spreadsheets, and tasklists to your Slack experience
- Elevate ideas to Quip docs
- Share Quip docs in Slack
- Get notified of changes to your docs
- Available on iOS/Android/Desktop/Web
- Online/Offline

Join & Write a Comment

This article discusses the ASP.NET AJAX ModalPopupExtender control. In this article we will show how to use the ModalPopupExtender control, how to display/show/call the ASP.NET AJAX ModalPopupExtender control from javascript, how to show/display/cal…
User art_snob (http://www.experts-exchange.com/M_6114203.html) encountered strange behavior of Android Web browser on his Mobile Web site. It took a while to find the true cause. It happens so, that the Android Web browser (at least up to OS ver. 2.…
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.
This video explains how to create simple products associated to Magento configurable product and offers fast way of their generation with Store Manager for Magento tool.

758 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

16 Experts available now in Live!

Get 1:1 Help Now