tbaseflug
asked on
Sring Conversion to INT
I have the code below and the last line of the page_load - sds3 default param - it is throwing the CS0029: Cannot implicitly convert type 'int' to 'string' error - what am I doing wrong...? The value is an int coming out of the db and set it to an int here ...
protected void Page_Load(object sender, EventArgs e)
{
//Get the URL
string myURL = string.Empty;
if (Request.UrlReferrer != null)
{
myURL = Request.UrlReferrer.Host.ToString();
}
else
{
myURL = "www.demo.com";
}
this.sds2.SelectParameters["URL"].DefaultValue = myURL;
string _providerDB = String.Empty;
string _providerName = String.Empty;
int _clientID = 169;
DataView userView = userView = (DataView)sds2.Select(DataSourceSelectArguments.Empty);
if (userView.Count > 0)
{
_providerDB = userView[0]["dbName"].ToString();
_providerName = userView[0]["FullName"].ToString();
_clientID = int.Parse(userView[0]["clientID"].ToString());
}
this.Literal1.Text = String.Format("The provider has been identified as: {0}", _providerName);
this.sds1.SelectParameters["strDB"].DefaultValue = _providerDB;
this.sds3.SelectParameters["clientID"].DefaultValue = _clientID;
}
ASKER CERTIFIED SOLUTION
membership
Create a free account to see this answer
Signing up is free and takes 30 seconds. No credit card required.
try using Convert.ToInt32(userView[0 ]["clientI D"].ToStri ng());