标题:[求助]数据库删除问题
只看楼主
fly_yan
Rank: 1
等 级:新手上路
帖 子:71
专家分:0
注 册:2008-10-10
得分:0 
嘿嘿 别慌嘛 慢慢来
2008-11-04 17:02
sun_life
Rank: 1
等 级:新手上路
帖 子:356
专家分:5
注 册:2006-5-29
得分:0 
你能给我一个具体的吗?

当知道自己后才知道什么是可怕!
2008-11-04 19:27
sun_life
Rank: 1
等 级:新手上路
帖 子:356
专家分:5
注 册:2006-5-29
得分:0 
using System;
using System.Collections.Generic;
using System.Text;

using System.Data;              //所有的一般数据访问类         
using System.Data.Sql;          //用于SQL Server数据访问的通用新接口和类
using System.Data.SqlClient;    //SQL Server提供程序的类
using System.Data.SqlTypes;     //SQL Server数据类型
using System.Data.Odbc;

using System.Configuration;     //在项目中要添加对System.Configuration的引用

namespace StudentManagementSystem
{
    class c_Binding         //数据绑定类
    {
        //SqlConnection conn = new SqlConnection("server=.;pwd=sun;user id=sa;database=SIM");     //数据库连接

        private static string connString = ConfigurationManager.ConnectionStrings["connString"].ConnectionString;

        SqlConnection conn = new SqlConnection(connString);

        //SqlConnection conn = c_conn.sqlconn();  //调用数据库连接类

        SqlCommand cmd = new SqlCommand();

        public static DataSet ds = new DataSet();

        public static SqlDataAdapter da;

        public c_Binding()
        {
        }

        public void DGV_Binding()       //绑定tb_AddUserInfo,Frm_UserinfoManagement中的DataGvidView
        {
            string str_Select = "select 用户名=t_UserName,姓名=t_name,民族=t_Nationality,性别=t_sex,学历=t_Education,学位=t_Degree,所在院系=t_CollegeDepartmentID,政治面貌=t_PoliticsStatus,职称=t_PositionalTitle,所学专业=t_studySpecial,入职时间=t_JObTime,职位=t_Position,身份证号=t_IDCard,固定电话=t_Phone,移动电话=t_MobileTelephone,E_Mail=t_Email,所教专业=t_teachSpecial,备注=t_remarks from tb_AddUserInfo";

            da = new SqlDataAdapter(str_Select, conn);

            da.Fill(ds, "tb_AddUserInfo");
        }
    }
}

        public void DGV_FillBD()
        {
            c_Binding UIM_Binding = new c_Binding();

            UIM_Binding.DGV_Binding();

            this.dGView_UserInfoManagement.DataSource =c_Binding.ds.Tables[0];
        }

        private void Frm_UserinfoManagement_Load(object sender, EventArgs e)
        {
            this.DGV_FillBD();
        }

        private void but_Del_Click(object sender, EventArgs e)
        {
            c_UIM UIM_UIM = new c_UIM();

            if (UIM_UIM.b_Del(lab_name.Text))
            {
                if (UIM_UIM.b_userDel(lab_name.Text))
                {
                    this.DGV_FillBD();

                    MessageBox.Show("数据删除成功!");
                }
            }
        }

在but_Del_Click事件中用this.DGV_FillBD()时DataGridView就显示双重数据了
我该怎么改

当知道自己后才知道什么是可怕!
2008-11-05 11:51



参与讨论请移步原网站贴子:https://bbs.bccn.net/thread-242358-1-1.html




关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.586950 second(s), 7 queries.
Copyright©2004-2025, BCCN.NET, All Rights Reserved