Suraj Kaushik's Blog

2 share my mistakes and lessons

Cannot implicitly convert type ‘int’ to ‘string’

Simple type casting problem, actually the value is INT datatype and trying to assign a variable with datatype string. Thats why we must convert variables to respective datatype properly before assigning to any other variable.

Server Error in ‘/dcorp’ Application.


Compilation Error

Description: An error occurred during the compilation of a resource required to service this request. Please review the following specific error details and modify your source code appropriately.

Compiler Error Message: CS0029: Cannot implicitly convert type ‘int’ to ‘string’

Source Error:

Line 26:         string userid = loginname.Text.ToString();
Line 27:         string pwd = password.Text.ToString();
Line 28: string userInfo = userObj.login(userid, pwd); Line 29:         switch (userInfo)
Line 30:         {


Source File: d:\developers\Suraj\projects\dunecorporation\Default.aspx.cs    Line: 28

Show Detailed Compiler Output:


Show Complete Compilation Source:


Version Information: Microsoft .NET Framework Version:2.0.50727.4927; ASP.NET Version:2.0.50727.4927

, ,

Leave a Reply

Your email address will not be published. Required fields are marked *

*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>