| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 659 人关注过本帖
标题:请高手们帮忙,是关于DataGrid的问题,小弟急啊!
只看楼主 加入收藏
yekong34
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2005-11-22
收藏
 问题点数:0 回复次数:7 
请高手们帮忙,是关于DataGrid的问题,小弟急啊!


小弟比较急啊,问了好多次了可是哪次也不明白,所以今天把图片拿上来了,我想请问,我图片里面的"删除","修改","刷新",怎么做啊!请大家帮帮忙吧!谢谢了啊!!
搜索更多相关主题的帖子: DataGrid 
2005-11-26 12:03
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
图开不了,反正都是用SQL语句,然后用Commond的Execute就可以了。
2005-11-26 12:07
唐伯猫
Rank: 8Rank: 8
等 级:贵宾
威 望:45
帖 子:5323
专家分:58
注 册:2005-8-9
收藏
得分:0 

我还真佩服你这样的精神,一个问题问了好几遍.被你感动了.那就看看下面的吧.(根据我以前做的)
private void button2_Click(object sender, System.EventArgs e)
{
this.sqlInsertCommand2.Parameters["@Id"].Value=textBox1.Text;
this.sqlInsertCommand2.Parameters["@name"].Value=textBox2.Text;
this.sqlInsertCommand2.Parameters["@Sex"].Value=textBox3.Text;
this.sqlInsertCommand2.Parameters["@Age"].Value=textBox4.Text;
this.sqlInsertCommand2.Parameters["@Telephone"].Value=textBox5.Text;
this.sqlInsertCommand2.Parameters["@Code"].Value=textBox6.Text;
this.sqlInsertCommand2.Connection.Open();
this.sqlInsertCommand2.ExecuteNonQuery();
this.sqlInsertCommand2.Connection.Close();
this.sqlConnection1.Open();
this.sqlDataAdapter2.Fill(this.dataSet11);
this.sqlConnection1.Close();
this.dataGrid1.Update();
this.dataGrid1.Refresh();
this.textBox1.Text="";this.textBox2.Text="";
this.textBox3.Text="";this.textBox4.Text="";
this.textBox5.Text="";this.textBox6.Text="";

}
private void button1_Click(object sender, System.EventArgs e)
{
this.sqlDeleteCommand3.CommandText="delete from 表名where Id='"+this.textBox12.Text.Trim()+"'or Name='"+this.textBox11.Text.Trim()+"'or Sex='"+this.textBox10.Text.Trim()+"'or Age='"+this.textBox9.Text.Trim()+"'or Telephone='"+this.textBox8.Text.Trim()+"'or Code='"+this.textBox7.Text.Trim()+"'";
this.sqlDeleteCommand3.Connection.Open();
this.sqlDeleteCommand3.ExecuteNonQuery();
this.dataSet11.Clear();
this.sqlDataAdapter1.Fill(this.dataSet11);
this.sqlDeleteCommand3.Connection.Close();
this.textBox12.Text="";this.textBox11.Text="";
this.textBox10.Text="";this.textBox9.Text="";
this.textBox8.Text="";this.textBox7.Text="";
}
private void button3_Click(object sender, System.EventArgs e)
{
if(radioButton1.Checked==true)
{
this.sqlSelectCommand3.CommandText="select * from 表名where Id='"+this.textBox13.Text.Trim()+"'";
}
else if(radioButton2.Checked==true)
{

this.sqlSelectCommand3.CommandText="select * from 表名 where Name='"+this.textBox13.Text.Trim()+"'";
}
this.sqlConnection1.Open();
this.sqlSelectCommand3.ExecuteNonQuery();
this.dataSet11.Clear();
this.sqlDataAdapter3.Fill(this.dataSet11);
this.dataGrid1.DataSource=this.dataSet11;
this.sqlSelectCommand3.Connection.Close();
if(this.dataSet11.Tables[0].Rows.Count>0)
{
MessageBox.Show("查找成功!","系统提示。",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
else
{
MessageBox.Show("查找不成功!","系统提示。",MessageBoxButtons.OK,MessageBoxIcon.Information);
}
this.textBox13.Text="";
}
如果你还没有成功的话,那就请你请教高手了.


<iframe name="alimamaifrm" frameborder="0" marginheight="0" marginwidth="0" border="0" scrolling="no" width="300" height="170" src="/go/app/tbk_app/chongzhi_300_170.php?pid=mm_28854300_2441872_11377541&page=chongzhi_300_170.php&size_w=300&size_h=170&stru_phone=1&stru_game=1&stru_travel=1" ></iframe>
2005-11-26 13:10
yekong34
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2005-11-22
收藏
得分:0 
先谢谢楼上的啊呵呵

2005-11-26 14:59
yekong34
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2005-11-22
收藏
得分:0 
this.oleDbDeleteCommand1.ExecuteNonQuery();有错误,不知道哪里不对

2005-11-26 15:09
live41
Rank: 10Rank: 10Rank: 10
等 级:贵宾
威 望:67
帖 子:12442
专家分:0
注 册:2004-7-22
收藏
得分:0 
你用SQL Server的话就把OleDb改成Sql。
2005-11-26 17:17
yekong34
Rank: 1
等 级:新手上路
帖 子:94
专家分:0
注 册:2005-11-22
收藏
得分:0 
this.oleDbDeleteCommand1.ExecuteNonQuery();有错误我用的是ACCESS啊

2005-11-26 21:18
zxugui
Rank: 1
等 级:新手上路
帖 子:3
专家分:0
注 册:2005-5-14
收藏
得分:0 
加载datagrid表时书写一个函数
刷新,删除时重新进行datagrid的加载
2005-11-27 19:57
快速回复:请高手们帮忙,是关于DataGrid的问题,小弟急啊!
数据加载中...
 
   



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

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