错误 1 无法将文件“E:\赵敏\c#源代码\myProject\学生管理系统\学生管理系统\database\studentManage.ldf”复制到“bin\Debug\database\studentManage.ldf”。文件“E:\赵敏\c#源代码\myProject\学生管理系统\学生管理系统\database\studentManage.ldf”正由另一进程使用,因此该进程无法访问该文件。 学生管理系统

解决方案 »

  1.   

    你项目里的studentManage.ldf文件正在被使用
    而你对这个文件的属性是“始终复制”
    所以编译器尝试将这个文件复制到调试目录bin\Debug\下的时候无法继续进行要么你吧studentManage.ldf的使用关闭,或者吧属性改为“如果较新则复制”
    应该就好了
      

  2.   


     if (this.txtUser.Text == "")
                {
                    MessageBox.Show("用户名不能为空!");
                    this.txtUser.Focus();
                    return;
                }
                else
                {
                    if (this.txtPwd.Text == "")
                    {
                        MessageBox.Show("密码 不能为空!");
                        this.txtPwd.Focus();
                        return;
                    }
                    else 
                    {
                        SqlConnection con = new SqlConnection(@"Data Source=.;Initial Catalog=studentManage;Integrated Security=True");
                        string sql="select * from operator where Op_user='"+this.txtUser.Text.ToString()+"'";
                        SqlDataAdapter da = new SqlDataAdapter(sql,con);
                        DataSet ds = new DataSet();
                        try
                        {
                            da.Fill(ds, "operator");                    }
                        catch (Exception)
                        {
                           MessageBox.Show("数据库未能成功连接");
                        }
                        if (ds.Tables["operator"].Rows[0][0].ToString()==this.txtPwd.Text.Trim())
                        {
                            user_name = ds.Tables[0].Rows[0][2].ToString();
                            user_level = ds.Tables[0].Rows[0][4].ToString();
                            this.Hide();
                            Main_info mi = new Main_info();
                            mi.Show();
                        }
                        else
                        {
                            MessageBox.Show("用户名和密码输入错误!!!");
                            this.txtPwd.Text=this.txtUser.Text="";
                            this.txtUser.Focus();
                            return;
                        }
                    }
                    
                }
    这是代码
      

  3.   

    ctrl+alt+delete把启动的线程停掉
      

  4.   

    在进程里  把所有 sql模样的进程关闭就OK 了  昨天我才碰到过
      

  5.   

    关闭SQL Server的服务管理器,然后把database文件夹复制到其他地方然后重新附加就可以了,但是不知道是为什么
      

  6.   

    与sql的连接未关闭吧?处于连接状态sql服务器当然不会让你复制了
      

  7.   

    因為DB文件被使用中... ... Attach上去就不能覆蓋了,把SQL服務停用就可以了