Solved

Cannot convert type 'string' to 'int'

Posted on 2006-10-26
1
191 Views
Last Modified: 2010-04-16
private int datetimeunitid;
 private int dateperiodtypeid;
       

  datetimeunitid = (int)_ds.Tables[0].Rows[0]["DateTimeUnitId"].ToString();
  dateperiodtypeid = (int)_ds.Tables[0].Rows[0]["DatePeriodTypeId"].ToString();
         
where

 public int DateTimeUnitId
        {
            get
            {
                return datetimeunitid;
            }
        }
       
        public int DatePeriodTypeId
        {
            get
            {
                return dateperiodtypeid;
            }
        }

     
0
Comment
Question by:mathieu_cupryk
1 Comment
 
LVL 23

Accepted Solution

by:
adathelad earned 250 total points
Comment Utility
Hi,

Try:
datetimeunitid = Convert.ToInt32(_ds.Tables[0].Rows[0]["DateTimeUnitId"]);
dateperiodtypeid = Convert.ToInt32(_ds.Tables[0].Rows[0]["DatePeriodTypeId"]);
0

Featured Post

6 Surprising Benefits of Threat Intelligence

All sorts of threat intelligence is available on the web. Intelligence you can learn from, and use to anticipate and prepare for future attacks.

Join & Write a Comment

Article by: Ivo
C# And Nullable Types Since 2.0 C# has Nullable(T) Generic Structure. The idea behind is to allow value type objects to have null values just like reference types have. This concerns scenarios where not all data sources have values (like a databa…
Real-time is more about the business, not the technology. In day-to-day life, to make real-time decisions like buying or investing, business needs the latest information(e.g. Gold Rate/Stock Rate). Unlike traditional days, you need not wait for a fe…
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…
Get a first impression of how PRTG looks and learn how it works.   This video is a short introduction to PRTG, as an initial overview or as a quick start for new PRTG users.

762 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

10 Experts available now in Live!

Get 1:1 Help Now