This topic is locked

Compiler Error Message: CS0266:

12/14/2006 1:44:04 PM
ASPRunner.NET General questions
swat author

Simple IF stament for the datafiled Month-
This code goes to Main_list.aspx.cs file

under

protected void dbGrid_Main_RowDataBound(object sender, GridViewRowEventArgs e)

if (rowData["Month"] =2)

{

response.Write("Do something");

}


ASP.NET 2.0 c#
Error:
Server Error in '/WERER' 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: CS0266: Cannot implicitly convert type 'object' to 'bool'. An explicit conversion exists (are you missing a cast?)
Source Error:
Line 149:

Line 150:

Line 151: if (rowData["Month"] =2)

Line 152:

Line 153: if (e.Row.Cells[5].Text.Length > 80)
Source File: e:\Inetpub\wwwroot\WERER\Main_list.aspx.cs Line: 151
Show Detailed Compiler Output:
--------------------------------------------------------------------------------

Version Information: Microsoft .NET Framework Version:2.0.50727.42; ASP.NET Version:2.0.50727.42 [/b]

Eugene 12/15/2006

try it:
if ( Convert.ToInt32(rowData["Month"]) == 2 )