2011-06-11 198 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; 
相關問題