2011-06-11 97 views
-4

我的代码是不是给编译错误:类型或命名空间名称“的Int32”找不到(是否缺少using指令或程序集引用?)

The type or namespace name 'Int32' could not be found (are you missing a using directive or an assembly reference?)

为什么会发生这种情况/我如何解决它?

这是有问题的代码:

///*********************************************************** 
///Author Name: Harkamal Singh 
///Creation Date: 17th Nov, 2008 
///File Name: CountryPrp.cs   Component Used: 
///Called From: Business Logic Layer 
///Description: Class File For Booking Functionality 
///Tables Accessed: 
///Program specs: 
///UTP doc: 
///Tested By: 
///*********************************************************************** 
///Modification History: 
///Change No. Changed By Date Version Raised By/SRS No Description 

///***********************************************************************using System; 
using System.Data; 
using System.Configuration; 
using System.Web; 
using System.Web.Security; 
using System.Web.UI; 
using System.Web.UI.WebControls; 
using System.Web.UI.WebControls.WebParts; 
using System.Web.UI.HtmlControls; 
using System.Data.SqlClient; 
using System.Collections; 
using System.Collections.Generic; 


/// <summary> 
/// Summary description for CountryPrp 
/// </summary> 
namespace BLL 
{ 
public class CountryPrp 
{ 
    public CountryPrp() 
{ 
     // 
     // TODO: Add constructor logic here 
     // 
    } 

    #region tCountryPropertyClass 

     private Int32 iCountryId; 
     private String sCountryName; 
     private DateTime dtCreated; 
     private DateTime dtModified; 
     private Int32 iCreatedBy; 
     private Int32 iModifiedBy; 
     private Boolean bisActive; 
     private Char sOperationType; 
     private Int16 iReturnid; 


     public Int32 p_iCountryId 
     { 
      get 
      { 
       return iCountryId; 
      } 
      set 
      { 
       iCountryId = value; 
      } 
     } 

     public String p_sCountryName 
     { 
      get 
      { 
       return sCountryName; 
      } 
      set 
      { 
       sCountryName = value; 
      } 
     } 

     public DateTime p_dtCreated 
     { 
      get 
      { 
       return dtCreated; 
      } 
      set 
      { 
       dtCreated = value; 
      } 
     } 

     public DateTime p_dtModified 
     { 
      get 
      { 
       return dtModified; 
      } 
      set 
      { 
       dtModified = value; 
      } 
     } 

     public Int32 p_iCreatedBy 
     { 
      get 
      { 
       return iCreatedBy; 
      } 
      set 
      { 
       iCreatedBy = value; 
      } 
     } 

     public Int32 p_iModifiedBy 
     { 
      get 
      { 
       return iModifiedBy; 
      } 
      set 
      { 
       iModifiedBy = value; 
      } 
     } 

     public Boolean p_bisActive 
     { 
      get 
      { 
       return bisActive; 
      } 
      set 
      { 
       bisActive = value; 
      } 
     } 
     public Char p_sOperationType 
     { 

      get 
      { 
       return sOperationType; 
      } 
      set 
      { 
       sOperationType = value; 
      } 

     } 

     public Int16 p_iReturnid 
     { 
      get 
      { 
       return iReturnid; 
      } 
      set 
      { 
       iReturnid = value; 
      } 

     } 



    #endregion 

} 
+6

无法找到类型或命名空间名称'Question'。 – 2011-06-11 14:43:46

+3

你错过了一个实际的问题。我已经添加了一个。如果它不代表你想问什么,请在你的真实问题中编辑。 – CodesInChaos 2011-06-11 14:53:09

+0

此外,您确实需要阅读.NET命名约定指南。你不应该使用匈牙利符号,并且为属性使用“p_”前缀是我见过的最丑陋的事情。 – 2011-06-12 14:44:02

回答

10

错误告诉你,你错过using System;由于Int32类型是命名空间的一部分。

///***********************************************************************using System; 

在您的代码中,您碰巧在using System;之前删除了换行符。这使得它移动到前面的行中,注释到//。所以它也被注释掉了。

把它放在一个新的线上,问题就会消失。

///*********************************************************************** 
using System; 
相关问题