• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 203
  • Last Modified:

Cannot convert type 'string' to 'int'

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
mathieu_cupryk
Asked:
mathieu_cupryk
1 Solution
 
adatheladCommented:
Hi,

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

Featured Post

Keep up with what's happening at Experts Exchange!

Sign up to receive Decoded, a new monthly digest with product updates, feature release info, continuing education opportunities, and more.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now