代码如下:
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
SqlConnection conn = db.conn();
if (e.CommandName == "del")
{
string sql = "delete from NewsContent where id=" + e.CommandArgument.ToString();
try
{
DataAccess.SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql);
fill();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
}
----------------------------错误显示为:
第 1 行: '=' 附近有语法错误
protected void GridView1_RowCommand(object sender, GridViewCommandEventArgs e)
{
SqlConnection conn = db.conn();
if (e.CommandName == "del")
{
string sql = "delete from NewsContent where id=" + e.CommandArgument.ToString();
try
{
DataAccess.SqlHelper.ExecuteNonQuery(conn, CommandType.Text, sql);
fill();
}
catch(Exception ex)
{
Response.Write(ex.Message);
}
}
}
----------------------------错误显示为:
第 1 行: '=' 附近有语法错误
这个没有传过来值
或者不是用的数字类型的!!
convert.toInt32(e.CommandArgument.ToString())???????????
的确是空的,应该怎么写呢?