解决方案 »

  1.   

     为什么中间还要放一个 this.show();
      

  2.   

    那个是删除数据后,UPDATE完ID后,重新显示数据库里最新的内容!
      

  3.   

    中间那个是 删完后重新显示数据到表格,然后用表格最新的内容UPDATE数据库!
      

  4.   

    在网上搜了“update”慢,有几贴相关的,说是用ADODB可以解决,我这边搞啊搞,搞到CONN.OPEN();就提示出错,有高手能给个ADODB,连接SQLITE数据的的实例吗?
      

  5.   

    你那论坛进不了。  csdn可以传rar。   你重传一下csdn
      

  6.   

    还真让我找到上传的地方了! 
    http://download.csdn.net/detail/zxvyio/8160091那个论坛没帐号也进不去了,你给的那个类很好用,但是,UPDATE,的时间也是要20秒以上!
      

  7.   

      private void button2_Click(object sender, EventArgs e)
            {
                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 里面的两列删掉。
      

  8.   

    Sqlite_helper sql = new Sqlite_helper();/// <summary>
            /// 数据库连接字符串
            /// </summary>
            string DataPath = Application.StartupPath + "\\sqlup_SJK.db3";注意这个。 要引用那个类。
    数据库路径要设置。
      

  9.   

    能给我看看你的sqlhelper么?用的事务http://blog.csdn.net/smeller/article/details/7396745