解决方案 »
- c# 如何定义全局变量?
- 用了很久的.NET开发Winform,今天试用了一下Delphi2010。。我的妈呀,。。好快喔!
- 请高手指点,如何用setupfactory注册ODBC数据源
- 一个简单的获取数据库密码的问题,帮我看看,解决即给分
- 如何将程序显示在右下角
- 一个字符串里有英文也有中文,我想得到这个字符串的Ascii码的长度
- 如何将select aa,bb from 我的数据,结果中的bb的一列存入ArrayList中
- 简单问题!象C#.NET里的方法提示是怎么做出来的!?
- UML问题
- treeview控件初始化及推荐书刊
- SQLITE 数据库 如何存取 byte[] 数据???
- asp.net 动态生成的linkButton如何绑定点击事件
http://download.csdn.net/detail/zxvyio/8160091那个论坛没帐号也进不去了,你给的那个类很好用,但是,UPDATE,的时间也是要20秒以上!
{
int index = this.dataGridView1.CurrentCell.RowIndex;
if (dataGridView1.SelectedRows.Count == 0) { MessageBox.Show("请选中要删除的记录!"); return; }
if (MessageBox.Show("是否要删除 ID = " + this.dataGridView1.Rows[index].Cells[0].Value.ToString() + "的记录?", "删除记录?", MessageBoxButtons.YesNo) == DialogResult.No) { return; } string SQL = "delete from test where ID=" + this.dataGridView1.Rows[this.dataGridView1.CurrentCell.RowIndex].Cells[0].Value.ToString(); if (sql.Sql_Execute(SQL) > 0)
{ }
else
MessageBox.Show("失败"); List<string> cmdlist = new List<string>();
cmdlist.Add("BEGIN;");
for (int i = 0; i < this.dataGridView1.Rows.Count; i++)
{ //SQL = "update IncomeStatistics set ID = '" + (i).ToString() + "' where ID = " + this.Income_dataGridView.Rows[this.Income_dataGridView.Rows.Count - i - 1].Cells[0].Value.ToString();
cmdlist.Add("update test set ggx = '" + (i).ToString() + "' where ID = " + this.dataGridView1.Rows[this.dataGridView1.Rows.Count - i - 1].Cells[0].Value.ToString() + ";");
}
cmdlist.Add("COMMIT;");
sql.Sql_insert(cmdlist);
Show2();
}
private void Show2()
{
this.dataGridView1.DataSource = null;
this.dataGridView1.Rows.Clear(); string SQL = "select id as 'ID',ggx as '更改项' from test ORDER BY ID ASC";
dataGridView1.DataSource = sql.Sql_DataTable(SQL);
} private void Form1_Load(object sender, EventArgs e)
{
Show2();
}dgv 里面的两列删掉。
/// 数据库连接字符串
/// </summary>
string DataPath = Application.StartupPath + "\\sqlup_SJK.db3";注意这个。 要引用那个类。
数据库路径要设置。