类型或命名空间名称';Int32';未能找到(是否缺少using指令或程序集引用?)
本文关键字:using 指令 程序集 是否 引用 命名空间 Int32 类型 | 更新日期: 2023-09-27 17:59:06
我的代码没有编译,出现错误:
找不到类型或命名空间名称"Int32"(是否缺少using指令或程序集引用?)
为什么会发生这种情况/我该如何解决?
这是有问题的代码:
///***********************************************************
///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
}
错误告诉您缺少using System;
,因为Int32
类型是该名称空间的一部分。
///***********************************************************************using System;
在您的代码中,您碰巧删除了using System;
之前的换行符。这使得它进入了用//
注释掉的前一行。所以它也被评论掉了。
把它放到一条新线上,问题就会解决。
///***********************************************************************
using System;