C#中数据库删除按钮中在下面update语句中显示数据库查询过于复杂

string connstr = "Provider=Microsoft.Jet.OleDb.4.0;";
connstr += @"Data Source=GEARCNC.mdb";

        OleDbConnection tempconn = null;

        try
        {
            if (MessageBox.Show("确定删除这一项吗?", "confirm Message", MessageBoxButtons.OKCancel) == DialogResult.OK)
            {

                tempconn = new OleDbConnection(connstr);

                OleDbDataAdapter GrindingWheelInformationDA = new OleDbDataAdapter("select * from GrindingWheelInformation order by 砂轮名称", tempconn);
                DataSet ds = new DataSet();
                GrindingWheelInformationDA.Fill(ds, "GrindingWheelInformation");
                int hang = this.listView1.SelectedIndices[0];
                DataRow dr = ds.Tables["GrindingWheelInformation"].Rows[hang];
                dr.Delete();
                OleDbCommandBuilder builder = new OleDbCommandBuilder(GrindingWheelInformationDA);
                GrindingWheelInformationDA.Update(ds, "GrindingWheelInformation");//这边报错,提示数据库查询过于复杂

                listView1.Items.Remove(listView1.SelectedItems[0]);
                MessageBox.Show("删除完毕!!!");
            }
        }
        catch (Exception ex)
        {
            MessageBox.Show("请选中一行需要删除的数据!");

        }
        finally
        {
            tempconn.Close();

        }

2个回答

你得把update这个方法贴出来呀,要不怎么看

caohuan95568
caohuan95568 倒数14行不是标出来了吗
4 年多之前 回复

select * from GrindingWheelInformation order by 砂轮名称
这句SQL很简单啊?

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!
立即提问