当前位置:编程学习 > C#/ASP.NET >>

CS0246: 找不到类型或命名空间名称“DataAcess”是否缺少 using 指令或程序集引---请教下大家!

[color=#0000FF]CS0246: 找不到类型或命名空间名称“DataAcess”(是否缺少 using 指令或程序集引)[/color]

请教下大家这个问题怎么解决?

相关代码:

using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using Accessibility;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strcmd = "";
        int i;
        DataAcess mydataAcess = new DataAcess( );
        if (TextBox1.Text.Trim() != "" && TextBox2.Text.Trim() != "")
        {
            if (DropDownList1.Text == "管理员")
            {
                strcmd = "select count(*) from admin  where  用户名='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 1;
            }
            if (DropDownList1.Text == "教师")
            {
                strcmd = "select count(*) from  teacher where  教师编号='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 2;
            }
            if (DropDownList1.Text == "学生")
            {
                strcmd = "select count(*) from  student where   学号='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 3;
            }
            i = mydataAcess.ExecuteScalar(strcmd);
            if (i == 1)
            {
                Session["Username"] = TextBox1.Text.ToString();
                if (temp == 1)
                    Response.Redirect("Default.aspx");
                if (temp == 2)
                    Response.Redirect("Default2.aspx");
                if (temp == 3)
                    Response.Redirect("Default3.aspx");
            }
            else
                Response.Write("<script LANGUAGE='javascript'>alert('账号或密码错误!');history.go(-1);</script>");
        }
        else
        {
            Response.Write("<script LANGUAGE='javascript'>alert('请输入账号或密码!');history.go(-1);</script>");
                TextBox1.Text = "";
                TextBox2.Text = "";
        }
    }
   
} --------------------编程问答--------------------  楼主的代码太亮了。 --------------------编程问答-------------------- 添加DataAcess所在程序集DLL的引用
using 命名空间; --------------------编程问答-------------------- 看不清楚,重发下!


using System;
using System.Configuration;
using System.Data;
using System.Linq;
using System.Web;
using System.Web.Security;
using System.Web.UI;
using System.Web.UI.HtmlControls;
using System.Web.UI.WebControls;
using System.Web.UI.WebControls.WebParts;
using System.Xml.Linq;
using System.Data.SqlClient;
using Accessibility;

public partial class _Default : System.Web.UI.Page 
{
    protected void Page_Load(object sender, EventArgs e)
    {

    }
    protected void Button1_Click(object sender, EventArgs e)
    {
        string strcmd = "";
        int i;
        DataAcess mydataAcess = new DataAcess( );
        if (TextBox1.Text.Trim() != "" && TextBox2.Text.Trim() != "")
        {
            if (DropDownList1.Text == "管理员")
            {
                strcmd = "select count(*) from admin  where  用户名='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 1;
            }
            if (DropDownList1.Text == "教师")
            {
                strcmd = "select count(*) from  teacher where  教师编号='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 2;
            }
            if (DropDownList1.Text == "学生")
            {
                strcmd = "select count(*) from  student where   学号='" + TextBox1.Text + "' and 密码='" + TextBox2.Text + "'";
                temp = 3;
            }
            i = mydataAcess.ExecuteScalar(strcmd);
            if (i == 1)
            {
                Session["Username"] = TextBox1.Text.ToString();
                if (temp == 1)
                    Response.Redirect("Default.aspx");
                if (temp == 2)
                    Response.Redirect("Default2.aspx");
                if (temp == 3)
                    Response.Redirect("Default3.aspx");
            }
            else
                Response.Write("<script LANGUAGE='javascript'>alert('账号或密码错误!');history.go(-1);</script>");
        }
        else
        {
            Response.Write("<script LANGUAGE='javascript'>alert('请输入账号或密码!');history.go(-1);</script>");
                TextBox1.Text = "";
                TextBox2.Text = "";
        }
    }
   
}
--------------------编程问答--------------------
引用 1 楼 karascanvas 的回复:
 楼主的代码太亮了。


能说 的再明白些吗?这方面不是很懂 --------------------编程问答--------------------
引用 2 楼 wuyq11 的回复:
添加DataAcess所在程序集DLL的引用
using 命名空间;


能再说明白些吗? --------------------编程问答-------------------- 在你的网站上右击添加引用把DataAcess这个类库添加到你的网站上去就行了 --------------------编程问答-------------------- DataAcess 好像不是.net framework中的东西。
1. 你要通过Add reference...把DataAcess 所在的assembly(dll)加入到你的工程中。
2. 要在文件前面引用DataAcess 所在的命名空间。
   在Add reference后,可以双击加入的assembly,会进入Ojbect Browser. 
   在这里可以看到DataAcess 所在的命名空间。
补充:.NET技术 ,  ASP.NET
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,