Solved

Cannot convert type 'string' to 'int'

Posted on 2006-10-26
1
194 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
ID: 17811324
Hi,

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

Featured Post

ScreenConnect 6.0 Free Trial

Discover new time-saving features in one game-changing release, ScreenConnect 6.0, based on partner feedback. New features include a redesigned UI, app configurations and chat acknowledgement to improve customer engagement!

Question has a verified solution.

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

Suggested Solutions

Exception Handling is in the core of any application that is able to dignify its name. In this article, I'll guide you through the process of writing a DRY (Don't Repeat Yourself) Exception Handling mechanism, using Aspect Oriented Programming.
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.
This Micro Tutorial hows how you can integrate  Mac OSX to a Windows Active Directory Domain. Apple has made it easy to allow users to bind their macs to a windows domain with relative ease. The following video show how to bind OSX Mavericks to …
A short tutorial showing how to set up an email signature in Outlook on the Web (previously known as OWA). For free email signatures designs, visit https://www.mail-signatures.com/articles/signature-templates/?sts=6651 If you want to manage em…

773 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