Recently, I was coding something using ADO.NET and my IDE appeared to be acting really wierd. All of a sudden my intellisense stopped working on a few items like ConnectionState and SqlDbType.
Here's the code that wasn't working (although the exact same code seemed to work everywhere else):
| try { if(cn.State != ConnectionState.Open){cn.Open();}//This caused //The type or namespace name 'ConnectionState' could not be found //(are you missing a using directive or an assembly reference?) } catch(SqlException ex){ Debug.Assert(false, ex.ToString());} cmd.CommandType = CommandType.StoredProcedure; //This line caused this exception: //C:\PhoneManager\InfoProMessage.cs(145): The type or namespace name 'CommandType' //could not be found (are you missing a using directive or an assembly reference?) |
| cmd.Parameters.Add("@Department", SqlDbType.VarChar, 50).Value = this.Company; cmd.Parameters.Add("@Contact", SqlDbType.VarChar, 50).Value = this.From; cmd.Parameters.Add("@MessageTaker", SqlDbType.VarChar, 50).Value = Environment.UserName; cmd.Parameters.Add("@Regarding", SqlDbType.VarChar, 50).Value = this.Regarding; cmd.Parameters.Add("@Message", SqlDbType.VarChar, 8000).Value = this.Message; //The above lines all caused similar exceptions... //C:\PhoneManager\InfoProMessage.cs(149): The type or namespace name 'SqlDbType' //could not be found (are you missing a using directive or an assembly reference?) |