操作数据库,更新dataset,重新绑定datagrid就行了
解决方案 »
- 高手们帮忙看下是什么问题
- 关于Winform设计器问题
- 求一个验证汉字和字母的正则表达式
- C#里正则表达式类Regex的$1,$2,$3在哪里?要怎么用?Replace时要在代替字符串里用$1,$2,$3又该怎么用?
- 『』【求高手给帮看一下这个存储过程的写法】
- 请教高手:treeview在浏览器中只能单击“+”才能打开吗?
- C# 中后台到数据库中查询数据前台的指针变成沙漏型?????如何实现!!!求各位大虾帮帮偶!!!
- 有谁知道web服务引用超时的解决方法 ,好像是win2003的问题
- 使用C#读取XML后 如何在TreeView中显示其树形结构???
- 求介绍多态的文章。
- DataGride里的HyperLinkColumn 如何URL加密?
- 网络编程的问题 , 希望大家多多发表意见!!
oleDbDataAdapter1.Update(dataSet11.book_inf );
DialogResult rs=MessageBox.Show( this,"你确定要删除客户["+clientname+"]吗?","提示",MessageBoxButtons.OKCancel,MessageBoxIcon.Question );
if( rs==DialogResult.OK ){
try{
ClientInfo c=new ClientInfo( Application.StartupPath );
c.delClientInfo( clientname );
MessageBox.Show( this,"删除成功!" );
refreshResult();
}
catch( Exception ex ){
MessageBox.Show( this,ex.Message );
return;
}
private System.Windows.Forms.BindingManagerBase mybind;
事件:
this.sqlDeletecmd1.CommandText = "delete authors where zip='"+this.dataSet1.Tables["authors"].Rows[mybind.Position]["zip"].ToString()+"'";
try
{
this.sqlConnection1.Open();
this.sqlDeletecmd1.ExecuteNonQuery();
this.sqlConnection1.Close();
this.dataSet1.Reset();
this.sqlSelectcmd1.CommandText = "select * from authors"
this.sqlDataAdapter1.Fill(this.dataSet1,"authors");
this.dv = this.dataSet1.Tables["authors"].DefaultView;
this.dv.AllowNew = false;
this.dv.AllowEdit = false;
this.dv.AllowDelete = false;
this.mybind = this.BindingContext[this.dv];
this.mybind.PositionChanged += new EventHandler(this.mybind_PositionChanged);
this.dataGrid1.DataSource = this.dv; }
catch(System.Data.SqlClient.SqlException ex)
{
if(this.sqlConnection1.State == System.Data.ConnectionState.Open)
this.sqlConnection1.Close();
MessageBox.Show(ex.ToString());
}