Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

reader smallint casting

Posted on 2007-11-19
3
Medium Priority
?
496 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:Starr Duskk
[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
  • 2
3 Comments
 
LVL 16

Accepted Solution

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

Open in new window

0
 
LVL 2

Author Comment

by:Starr Duskk
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

Concerto Cloud for Software Providers & ISVs

Can Concerto Cloud Services help you focus on evolving your application offerings, while delivering the best cloud experience to your customers? From DevOps to revenue models and customer support, the answer is yes!

Learn how Concerto can help you.

Question has a verified solution.

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

A quick way to get a menu to work on our website, is using the Menu control and assign it to a web.sitemap using SiteMapDataSource. Example of web.sitemap file: (CODE) Sample code to add to the page menu: (CODE) Running the application, we wi…
Problem Hi all,    While many today have fast Internet connection, there are many still who do not, or are connecting through devices with a slower connect, so light web pages and fast load times are still popular.    If your ASP.NET page …
This is my first video review of Microsoft Bookings, I will be doing a part two with a bit more information, but wanted to get this out to you folks.
This tutorial will teach you the special effect of super speed similar to the fictional character Wally West aka "The Flash" After Shake : http://www.videocopilot.net/presets/after_shake/ All lightning effects with instructions : http://www.mediaf…
Suggested Courses

705 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