删除命令在ASP.NET中不起作用 [英] Delete command is not working in ASP.NET

查看:74
本文介绍了删除命令在ASP.NET中不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我试图在主键的基础上从asp.net中的gridview中删除一行。

我不知道我的代码中缺少的地方。请帮忙找出我的错误。



我的尝试:



I am trying to delete a row from gridview in asp.net on the base of primary key.
I don't know where i am missing in my code. Please help to find out my error.

What I have tried:

//that is my method which i am using
 protected void deleting() {

            conn.Open();
            string del = "Delete from Task_Assingment where [Row#] = @Row#";
            SqlCommand sq = new SqlCommand(del, conn);
            sq.ExecuteNonQuery();
            conn.Close();

        }
//in that code Row# is my column name(which is my primary key)

推荐答案

need to have initialization of row# to delete the entire row. just assign the id to given variable to make it work.
where [row#] must have to be assigned to id can use cell_row_click in Grid to select the very first id by using [e.index] method to assign the id or any other means to have flow to be created from id of dB to grid . thank you  


这篇关于删除命令在ASP.NET中不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆