时间:2016-02-16 02:47 来源: 我爱IT技术网 作者:佚名
欢迎您访问我爱IT技术网,今天小编为你分享的编程技术是:【sqlserver 批量数据替换助手V1.0版发布】,下面是详细的讲解!
sqlserver 批量数据替换助手V1.0版发布
#region 执行批量替换操作
/// <summary>
/// 执行批量替换操作
/// </summary>
/// <param name="sender"></param>
/// <param name="e"></param>
private void ExecuteFilterBtn_Click(object sender, EventArgs e)
{
saveConfig();
total=0;
if (this.chkboxTableList.CheckedIndices.Count==0) return; //没有选中任何表的情况
if (this.txtSearchKey.Text.Trim()=="")
{
DialogResult result=MessageBox.Show("当前查找内容为空,确认此操作?", "提示", MessageBoxButtons.YesNo, MessageBoxIcon.Question, MessageBoxDefaultButton.Button1);
if (result==DialogResult.No) return;
}
this.ExecuteFilterBtn.Enabled=false;
List<TableInfo> tabList=new List<TableInfo>();
string searchString=this.txtSearchKey.Text.Trim()=="" ? " " : this.txtSearchKey.Text;
string replaceString=this.txtReplaceStr.Text;
KeyType kt=this.chkIsRegex.Checked==true ? KeyType.Regex : KeyType.Text;
bool isRegex=this.chkIsRegex.Checked;
//得到被选中表的基本信息,并添加到集合中
foreach (int index in this.chkboxTableList.CheckedIndices)
{
string tabName=this.chkboxTableList.Items[index].ToString();
TableInfo tInfo=FilterInfo.initTableInfo(tabName);
if (tInfo==null)
{
continue;
}
tabList.Add(tInfo);
}
try
{
if (tabList.Count==0) return; //没有符合检测的数据表
pBar1.Visible=true;
pBar1.Minimum=1;
pBar1.Maximum=tabList.Count;
pBar1.Value=1;
pBar1.Step=1;
//循环过滤表中要替换的数据
foreach (TableInfo info in tabList)
{
FilterInfo.Execute(info, searchString, replaceString, kt);
pBar1.PerformStep(); //进度条
}
}
catch (Exception ex)
{
MessageBox.Show(string.Format("异常:{0}", ex.Message), "错误", MessageBoxButtons.OK, MessageBoxIcon.Error);
return;
}
finally
{
this.ExecuteFilterBtn.Enabled=true;
}
MessageBox.Show(string.Format("数据替换完毕,共有{0}行数据被修改!",total),"消息", MessageBoxButtons.OK, MessageBoxIcon.Information);
}
#endregion
关于sqlserver 批量数据替换助手V1.0版发布的用户互动如下:
相关问题:
答: >>详细
相关问题:
答: >>详细
相关问题:
答: >>详细
- 【asp】asp.net url重写浅谈-net-url重写
- 【DataSet】DataSet、DataTable、DataRow区别详解
- 【asp】asp.net 动态添加多个用户控件-net-动态添
- 【ASP】ASP.NET中内嵌页面代码的一个问题-NET-内
- 【As】Asp.net中的页面乱码的问题-sp--pn-ne-et
- 【增加记录】asp.net中获取新增加记录的ID Access
- 【创建】ASP.NET Web API教程 创建域模型的方法详
- 【Asp】Asp.net 页面调用javascript变量的值-net-
- 【ASP】ASP.NET 5升级后如何删除旧版本的DNX-NET5
- 【404页面】ASP.NET设置404页面返回302HTTP状态码
- 评论列表(网友评论仅供网友表达个人看法,并不表明本站同意其观点或证实其描述)
-
