回 帖 发 新 帖 刷新版面

主题:各位帮帮忙

string StrSQL="DELETE FROM gqsz WHERE  xh='"+this.listView1.SelectedItems [0].Text.Trim()+"'";
     this.sqlCommand1.CommandText=StrSQL;
     this.sqlCommand1.Connection=this.con;
    //打开数据库连接
    this.con.Open();
    //执行SQL命令
    this.sqlCommand1.ExecuteNonQuery();
    //关闭连接
    this.con.Close();
    //更新数据集
    this.dataSet1.Tables["gqsz"].Rows[this.MyBind.Position].BeginEdit();
    this.dataSet1.Tables["gqsz"].Rows[this.MyBind.Position].EndEdit();                
    this.dataSet1.AcceptChanges();
    this.SqlDataAdapter1.Fill(this.dataSet1,"gqsz");
    this.MyBind.Position=this.MyBind.Count;

    MessageBox.Show("此操作将会删除选定的歌曲","信息提 示",MessageBoxButtons.YesNo,MessageBoxIcon.Question,MessageBoxDefaultButton.Button1);



错误显示:未将对象引用设置到对象实例

回复列表 (共2个回复)

沙发

估计是你的dataset没弄

板凳

错误要写清楚嘛,哪一行出错。

有了错误提示,再知道哪一行。是什么错误就知道了。

我来回复

您尚未登录,请登录后再回复。点此登录或注册