Solved

Cannot convert type 'string' to 'int'

Posted on 2006-10-26
1
192 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

Is Your Active Directory as Secure as You Think?

More than 75% of all records are compromised because of the loss or theft of a privileged credential. Experts have been exploring Active Directory infrastructure to identify key threats and establish best practices for keeping data safe. Attend this month’s webinar to learn more.

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
Parse the OuterHTML Data in the txtfile using c# 4 48
Syntax error 9 45
Export import database 4 42
C# MVC and a global static factory that never dies 4 46
Introduction This article series is supposed to shed some light on the use of IDisposable and objects that inherit from it. In essence, a more apt title for this article would be: using (IDisposable) {}. I’m just not sure how many people would ge…
It was really hard time for me to get the understanding of Delegates in C#. I went through many websites and articles but I found them very clumsy. After going through those sites, I noted down the points in a easy way so here I am sharing that unde…
This Micro Tutorial demonstrates using Microsoft Excel pivot tables, how to reverse engineer competitors' marketing strategies through backlinks.
Learn how to create flexible layouts using relative units in CSS.  New relative units added in CSS3 include vw(viewports width), vh(viewports height), vmin(minimum of viewports height and width), and vmax (maximum of viewports height and width).

911 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

17 Experts available now in Live!

Get 1:1 Help Now