表示成:
protected void grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string chexingid = grid.DataKeys[e.RowIndex].Value.ToString();
string sucheng = ((TextBox)grid.Rows[e.RowIndex].FindControl("suchengTextBox")).Text;
string description = ((TextBox)grid.Rows[e.RowIndex].FindControl("descriptionTextBox")).Text;
string imagefilename = ((TextBox)grid.Rows[e.RowIndex].FindControl("tupianTextBox")).Text;
bool success = CatalogAccess.UpdateCheXing(chexingid, sucheng, description, imagefilename);
grid.EditIndex=-1;
statusLabel.Text=success?"更新成功":"更新失败";
BindGrid();
}
------------------------------------------
业务层(CatalogAccess):
public static bool UpdateCheXing(string chexingid, string sucheng, string description, string imagefilename)
{
SqlCommand comm = GenericDataAccess.CreateCommand();
comm.CommandText = "UpdateCheXing";
SqlParameter param = comm.CreateParameter();
param.ParameterName = "@CheXingID";
param.Value = "chexingid";
param.SqlDbType = SqlDbType.Int;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@SuCheng";
param.Value = "sucheng";
param.SqlDbType = SqlDbType.VarChar;
param.Size = 50;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@Description";
param.Value="description";
param.SqlDbType = SqlDbType.VarChar;
param.Size = 2000;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@ImageFileName";
param.Value = "imagefilename";
param.SqlDbType = SqlDbType.VarChar;
param.Size = 50;
comm.Parameters.Add(param);
int result = -1;
try
{
result = GenericDataAccess.ExecuteNonQuery(comm);
}
catch
{
//
}
return (result != -1);
-----------------------------------------------
存储过程:
ALTER PROCEDURE UpdateCheXing(
@CheXingID int,
@SuCheng varchar(50),
@Description varchar(2000),
@ImageFileName varchar(50))
AS
Update CheXingList
set Description=@Description,SuCheng=@SuCheng,ImageFileName=@ImageFileName
where CheXingID=@CheXingID
--------------------------------------------------
就是点击编辑,更新后 不成功 vs也不报错 不知道问题出在哪里?太晚了睡觉了 大家帮忙看下~~~~~~
protected void grid_RowUpdating(object sender, GridViewUpdateEventArgs e)
{
string chexingid = grid.DataKeys[e.RowIndex].Value.ToString();
string sucheng = ((TextBox)grid.Rows[e.RowIndex].FindControl("suchengTextBox")).Text;
string description = ((TextBox)grid.Rows[e.RowIndex].FindControl("descriptionTextBox")).Text;
string imagefilename = ((TextBox)grid.Rows[e.RowIndex].FindControl("tupianTextBox")).Text;
bool success = CatalogAccess.UpdateCheXing(chexingid, sucheng, description, imagefilename);
grid.EditIndex=-1;
statusLabel.Text=success?"更新成功":"更新失败";
BindGrid();
}
------------------------------------------
业务层(CatalogAccess):
public static bool UpdateCheXing(string chexingid, string sucheng, string description, string imagefilename)
{
SqlCommand comm = GenericDataAccess.CreateCommand();
comm.CommandText = "UpdateCheXing";
SqlParameter param = comm.CreateParameter();
param.ParameterName = "@CheXingID";
param.Value = "chexingid";
param.SqlDbType = SqlDbType.Int;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@SuCheng";
param.Value = "sucheng";
param.SqlDbType = SqlDbType.VarChar;
param.Size = 50;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@Description";
param.Value="description";
param.SqlDbType = SqlDbType.VarChar;
param.Size = 2000;
comm.Parameters.Add(param);
param = comm.CreateParameter();
param.ParameterName = "@ImageFileName";
param.Value = "imagefilename";
param.SqlDbType = SqlDbType.VarChar;
param.Size = 50;
comm.Parameters.Add(param);
int result = -1;
try
{
result = GenericDataAccess.ExecuteNonQuery(comm);
}
catch
{
//
}
return (result != -1);
-----------------------------------------------
存储过程:
ALTER PROCEDURE UpdateCheXing(
@CheXingID int,
@SuCheng varchar(50),
@Description varchar(2000),
@ImageFileName varchar(50))
AS
Update CheXingList
set Description=@Description,SuCheng=@SuCheng,ImageFileName=@ImageFileName
where CheXingID=@CheXingID
--------------------------------------------------
就是点击编辑,更新后 不成功 vs也不报错 不知道问题出在哪里?太晚了睡觉了 大家帮忙看下~~~~~~
解决方案 »
- asp.net页面设计问题关于 HyperLink 和imagebutton
- 关于下载的问题~急。。在线等
- 如何向已有的excel文件的一个特定表格比如A1写入"hello"?
- 8.1建军节散分
- 求救,权限控制问题
- 那位高手能帮我讲讲索引器的概念和用法?
- 为了直接修改DataGrid中的值,加入了文本框,如何取得修改后的文本框的值?在线。
- 我在程序中使用了Excel这个COM对象,打包后到别的服务器上安装,提示“拒绝访问”这个错误
- 如何在后台 cs 中创建webform 而不是在aspx中写<asp:TextBox>...
- GridView 自定义模板显示不出来内容,急急急!
- 关于gridview删除的问题
- 还是asp中DataList中radiobutton的问题
{
//
}
==
catch(Exception ex)
{
throw ex;
}