点修改不能显示修改的内容~~~急死了(这里面有部分代码)帮我看看
string UpdateStr="Update Suppliers set"
+" CompanyName= '"+CompanyName+"',ContactName='"+ContactName+"',ContactTitle='"+ContactTitle+"',Address='"+Address+"',City='"+City+"',Region='"+Region+"',PostalCode='"+PostalCode+"',Country='"+Country+"',Phone='"+Phone+"',Fax='"+Fax+"',HomePage='"+HomePage+"' where SupplierID = "+SupplierID;
//下面一行一定有问题!!
DB.ExecuteSql(UpdateStr);
Response.Redirect("Suppliers.aspx");
上面是Modify.aspx的。
下面是DB.ExecuteSql的
public void ExecuteSql(string strSql)
{
int RecordCount;
try
{
Open();
SC=new SqlCommand(strSql,Conn);
RecordCount=SC.ExecuteNonQuery();
}
catch(Exception e)
{
WriteMessage(e.Message.ToString(),true,true);
}
finally
{
Close();
Dispose();
}
}
下面是Supplier.aspx的
protected void DG_Suppliers_Bind()
{
string SelectStr="Select* from Suppliers";
DB.BindDataGrid(SelectStr,DG_Suppliers);
}
private void Page_Load(object sender, System.EventArgs e)
{
if(!Page.IsPostBack)
DG_Suppliers_Bind();
}
下面是DB.BindDataGrid
public void BindDataGrid(string strSql,DataGrid DG)
{
try
{
Open();
Fill(strSql);
DG.DataSource=DS.Tables[0].DefaultView;
if(DG.CurrentPageIndex>DG.PageCount-1)
{
if(DG.PageCount>0)
DG.CurrentPageIndex=DG.PageCount-1;
else
DG.CurrentPageIndex=0;
}
DG.DataBind();
}
catch(Exception e)
{
WriteMessage(e.Message.ToString(),true,true);
}
finally
{
Close();
Dispose();
}
}
public void Fill(string strSql)
{
try
{
Open();
SDA=new SqlDataAdapter(strSql,Conn);
DS=new DataSet();
SDA.Fill(DS);
}
catch(Exception e)
{
WriteMessage(e.Message.ToString().Trim(),true,true);
}
finally
{
Close();
Dispose();
}
}
public void Open()
{
try
{
string ConnStr=System.Configuration.ConfigurationSettings.AppSettings["conn"].ToString().Trim();
Conn=new SqlConnection(ConnStr);
Conn.Open();
}
catch(Exception e)
{
WriteMessage(e.Message.ToString(),true,true);
}
}
。。。。。。。。。。。找不出问题,要是还需要什么我再贴上来,谢拉