我在编程的时候 出现如下问题:
private void UserDelete_Click(object sender, EventArgs e)
        {
            try 
            {
                string StrSQL = "DELETE FROM User_Info";
                StrSQL += "User_Info.ID'" + this.iDTextBox.Text + "'";                OleDbCommand oleDbCommand1 = new OleDbCommand();
                oleDbCommand1.CommandText = StrSQL;
                oleDbCommand1.Connection = this.oleDbConnection1;                //打开数据连接
                oleDbConnection1.Open();
                //执行SQL语句
                oleDbCommand1.ExecuteNonQuery();
                //关闭连接
                oleDbConnection1.Close();                //更新数据
                qCUserDataSet.Tables["User_Info"].Rows[userInfoBindingSource.Position].BeginEdit();
                qCUserDataSet.Tables["User_Info"].Rows[userInfoBindingSource.Position].EndEdit();
                qCUserDataSet.AcceptChanges();
                oleDbDataAdapter1.Fill(this.qCUserDataSet, "User_Info");
                userInfoBindingSource.Position = 0;                MessageBoxEx.Show("删除数据集记录操作成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
            }
            catch (Exception Err)
            {
                MessageBoxEx.Show("删除数据集记录操作失败:" + Err.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                if (oleDbConnection1.State == ConnectionState.Open)
                {
                    this.oleDbConnection1.Close();
                }
            }
        }
是一个删除 表记录的操作,但是在执行  过程中出错提示:找不到输出表;
那位高手 能告诉我问题出在哪里了吗?

解决方案 »

  1.   

    string StrSQL = "DELETE FROM User_Info";
    StrSQL += "User_Info.ID'" + this.iDTextBox.Text + "'";楼主你设个断点 看下 StrSQL等于什么? 有问题
      

  2.   

    string StrSQL = "DELETE FROM User_Info";
    StrSQL += "User_Info.ID'" + this.iDTextBox.Text + "'";----------------------------------------------------
     组成的SQL语句明显有问题哈,你连where子句都没有
      

  3.   

    1.string StrSQL = "DELETE FROM User_Info";
      StrSQL += "User_Info.ID'" + this.iDTextBox.Text + "'";
    SQL是不是拼错了?
      

  4.   

    增加的时候也是同样的问题  代码如下:
    可以看看private void UserAdd_Click(object sender, EventArgs e)
            {//增加记录
                if (this.iDTextBox.Text.Length < 1 | this.nameTextBox.Text.Length < 1 | this.passwordTextBox.Text.Length < 1 | this.biaoShiTextBox.Text.Length < 1)
                {
                    MessageBoxEx.Show("客户所有信息必须填写!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    return;
                }
                try
                {                string StrSQL = "INSERT INTO Use_Info('ID','Name','Password','Biaoshi')VALUES('";
                    StrSQL += this.iDTextBox.Text.Trim() + "','";
                    StrSQL += this.nameTextBox.Text.Trim() + "','";
                    StrSQL += this.passwordTextBox.Text.Trim() + "','";
                    StrSQL += this.biaoShiTextBox.Text.Trim() + "')";                 OleDbCommand oleDbCommand1 = new OleDbCommand();
                    oleDbCommand1.CommandText = StrSQL;
                    oleDbCommand1.Connection = oleDbConnection1;                //打开数据连接
                    oleDbConnection1.Open();
                    //执行SQL语句
                    oleDbCommand1.ExecuteNonQuery();
                    //关闭连接
                    oleDbConnection1.Close();                //更新数据
                    qCUserDataSet.Tables["User_Info"].Rows[userInfoBindingSource.Position].BeginEdit();
                    qCUserDataSet.Tables["User_Info"].Rows[userInfoBindingSource.Position].EndEdit();
                    qCUserDataSet.AcceptChanges();
                    oleDbDataAdapter1.Fill(this.qCUserDataSet, "User_Info");
                    userInfoBindingSource.Position = 0;                MessageBoxEx.Show("增加数据集记录操作成功!", "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                }
                catch (Exception Err)
                {
                    MessageBoxEx.Show("增加数据集记录操作失败:"+Err.Message, "信息提示", MessageBoxButtons.OK, MessageBoxIcon.Information);
                    if (oleDbConnection1.State == ConnectionState.Open)
                    {
                        this.oleDbConnection1.Close();
                    }
                }        }