关于using CommonDataTool
有的人的程序里可以用using CommonDataTool这个命名空间,我的程序里却不能,为什么?
程序:
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 CommonDataTool;
public class CompanyProduct
{
OleDbCommonTool objTool;
public CompanyProduct(string ConnString)
{
objTool = new OleDbCommonTool(ConnString);
}
//添加设备
public void addCompanyProduct(string Product_Name, string Product_Picture)
{
string Sql = "insert into Product(Product_Name,Product_Picture) values('" + Product_Name + "','" + Product_Picture + "')";
try
{
objTool.ExeNoQuery(Sql);
}
catch (Exception ce)
{
throw new Exception(ce.Message);
}
}
public void deleteProduct(int Product_ID)
{
string Sql = "delete from Product where Product_ID=" + Product_ID + "";
try
{
objTool.ExeNoQuery(Sql);
}
catch (Exception ce)
{
throw new Exception(ce.Message);
}
}
public DataSet executeNonQuery(string Sql)
{
try
{
return objTool.ExeDataSet(Sql);
}
catch
{
throw new Exception(Sql);
}
}
public DataSet productDisplay(string Sql)
{
string Conn = "select * from " + Sql + "";
try
{
return objTool.ExeDataSet(Conn);
}
catch
{
throw new Exception(Sql);
}
}
}
public partial class _Default : System.Web.UI.Page
{
CompanyProduct objProduct;
PagedDataSource objPage;
string ProductClass;
string sqlstring;
//CompanyTrend objTrend;
protected void Page_Load(object sender, EventArgs e)
{
ProductClass = Request.QueryString["Class"];
if (ProductClass == "MSL05")
{
sqlstring = "Product Where Product_Class='MSL05'";
this.btn_micro_PV.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "All")
{
sqlstring = "Product";
this.btn_all.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL01")
{
sqlstring = "Product Where Product_Class='MSL01'";
this.btn_solarLED.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL02")
{
sqlstring = "Product Where Product_Class='MSL02'";
this.btn_batLED.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL03")
{
sqlstring = "Product Where Product_Class='MSL03'";
this.btn_lawnlamp.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL06")
{
sqlstring = "Product Where Product_Class='MSL06'";
this.btn_PV_ctrl.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL-LED01")
{
sqlstring = "Product Where Product_Class='MSL-LED01'";
this.btn_LEDlamp.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL-LED02")
{
sqlstring = "Product Where Product_Class='MSL-LED02'";
this.btn_LEDbulb.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL-LED03")
{
sqlstring = "Product Where Product_Class='MSL-LED03'";
this.btn_alveolateLED.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL-LED04")
{
sqlstring = "Product Where Product_Class='MSL-LED04'";
this.btn_hpLED.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL-LED05")
{
sqlstring = "Product Where Product_Class='MSL-LED05'";
this.btn_otherLED.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else if (ProductClass == "MSL04")
{
sqlstring = "Product Where Product_Class='MSL04'";
this.btn_courtyard.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
else
{
sqlstring = "Product";
this.btn_all.BackColor = System.Drawing.Color.FromName("#80d3fa");
}
if (!IsPostBack)
{
BingDing(sqlstring);
}
}
public void BingDing(string mysql)
{
//this.ddlstTrend.DataSource = objTrend.trendDisplay("select top 5 * from CompanyTrend order by Companytrend_Time desc");
//this.ddlstTrend.DataBind();
string connString = ConfigurationManager.AppSettings["ConnString"].ToString() + Server.MapPath(ConfigurationManager.AppSettings["dbPath"].ToString());
objProduct = new CompanyProduct(connString);
objPage = new PagedDataSource();
objPage.AllowPaging = true;
objPage.PageSize = 6;
int curPage;
this.objPage.DataSource = objProduct.productDisplay(mysql).Tables[0].DefaultView;
if (Request.QueryString["page"] != null)
{
curPage = int.Parse(Request.QueryString["page"]);
}
else
{
curPage = 1;
}
objPage.CurrentPageIndex = curPage - 1;
//如果不是首条记录
if (!objPage.IsFirstPage)
{
this.HyperLink1.NavigateUrl = Request.CurrentExecutionFilePath + "?Class=" + ProductClass + "&" + "page=" + Convert.ToString(curPage - 1);
}
//如果不是最后一条记录
if (!objPage.IsLastPage)
{
this.HyperLink2.NavigateUrl = Request.CurrentExecutionFilePath + "?Class=" + ProductClass + "&" + "page=" + Convert.ToString(curPage + 1);
}
this.Label5.Text = "" + (objPage.CurrentPageIndex + 1);
this.Label6.Text = "" + objPage.PageCount;
this.ddlstProduct.DataSource = objPage;
this.ddlstProduct.DataBind();
}
protected void btn_micro_PV_Click(object sender, EventArgs e)
{
// string mysql;
// mysql = "Product Where Product_Class='MSL05'";
Response.Redirect("productDisplay.aspx?Class=MSL05");
}
protected void btn_all_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=All");
}
protected void btn_PV_ctrl_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL06");
}
protected void btn_solarLED_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL01");
}
protected void btn_batLED_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL02");
}
protected void btn_lawnlamp_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL03");
}
protected void btn_otherLED_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL-LED05");
}
protected void btn_hpLED_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL-LED04");
}
protected void btn_alveolateLED_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL-LED03");
}
protected void btn_LEDbulb_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL-LED02");
}
protected void btn_LEDlamp_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL-LED01");
}
protected void btn_courtyard_Click(object sender, EventArgs e)
{
Response.Redirect("productDisplay.aspx?Class=MSL04");
}
}
报错:
错误 1 找不到类型或命名空间名称“CommonDataTool”(是否缺少 using 指令或程序集引用?) F:\\company\fen.html\ProductDisplay\Default.aspx.cs 10 7 F:\...\ProductDisplay\
错误 2 找不到类型或命名空间名称“OleDbCommonTool”(是否缺少 using 指令或程序集引用?) F:\\company\fen.html\ProductDisplay\Default.aspx.cs 14 5 F:\...\ProductDisplay\