无法更新数据库数据(急)
一个郁闷的问题。
直接在UpdateSite里用测试值做参数就可以修改数据,
bool successful = siteinfo.UpdateSite( "xx ", 2, "1 ", 2, "222 ", "adf ", "designinfo ", "developerinfo ", true, "previewinfo ", 1);
但是将测试的值改成变量传参
bool successful = siteinfo.UpdateSite(sitename, sitecycle, sitecontent, stateid, designer, developer, designerinfo, developerinfo, ispreview, previewinfo, siteid);
也会提示修改成功,但是数据库值没有改变。
详细代码如下:BLL层代码没有贴出。
protected void but_SiteMod_Click(object sender, EventArgs e)
{
string sitename = SiteName.Text;
int sitecycle = Convert.ToInt16(Cycle.Text);
int stateid = Convert.ToInt16(StateID.SelectedValue);
bool ispreview = IsPreview.Checked;
string designer = Designer.Text;
string developer = Developer.Text;
string designerinfo = Designer.Text;
string developerinfo = Developer.Text;
string previewinfo = PreviewInfo.Text;
string sitecontent = Content.Value.ToString();
int siteid = Convert.ToInt16(Request.QueryString[ "siteID "]);
SiteBLL siteinfo = new SiteBLL();
//bool successful = siteinfo.UpdateSite( "xx ", 2, "1 ", 2, "222 ", "adf ", "designinfo ", "developerinfo ", true, "previewinfo ", 1);
bool successful = siteinfo.UpdateSite(sitename, sitecycle, sitecontent, stateid, designer, developer, designerinfo, developerinfo, ispreview, previewinfo, siteid);
}
------解决方案--------------------你调试到这一步:
bool successful = siteinfo.UpdateSite(sitename, sitecycle, sitecontent, stateid, designer, developer, designerinfo, developerinfo, ispreview, previewinfo, siteid);
看看每个变量是不是注释那一行的一样。
------解决方案--------------------我搜索了一下,也有人遇到同样的情况 Adapter.Update 用的不多
http://post.10026.com/net/asp/20066165202_4803835.shtml
你也搜索一下
抱歉帮不了你
------解决方案--------------------注:
bool successful = siteinfo.UpdateSite(sitename, 2, "1 ", 2, "222 ", "adf ", "designinfo ", "developerinfo ", true, "previewinfo "