如何从表单将值保存到数据库 [英] How do i save values to the database from the form

查看:509
本文介绍了如何从表单将值保存到数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述



Iam Prasanna我设计了dhtml表单,并且在将值更新为不保存到数据库,不更新到数据库中时将值从数据库获取到表单中.所以请帮助我

IAM开发ASP.NET MVC3应用程序
Iam正在使用visualstudio 2010
IAM使用mysql数据库
我没有任何错误

Hi ,

Iam Prasanna I design dhtml form and am getting values from database into the form when updating values in the form it is not saving to the database it is not updating into the database.So please help me

Iam developing asp.net mvc3 application
Iam Using visualstudio 2010
Iam using mysql database
Iam getting no errors

推荐答案

普拉萨纳.就像我看到的那样,您没有解释如何尝试将数据保存回数据库的过程.我建议您在"Page_Load"事件处理程序中设置代码,以使用"IsPostBack"检查其回发.像:
Hi Prasanna. Well as I see you haven''t explained the procedure how you''re trying to save the data back into the database. I suggest you to set your code inside "Page_Load" event handler to check if its a postback using "IsPostBack" . like:
protected void Page_Load(object sender, EventArgs e)
{            
  if (!IsPostBack)
  {
    // code goes here.
  }
}



这背后发生的事情是,每当服务器端控件首先创建一个回发事件时,它就会执行Page_Load事件.

希望对您有帮助.

Rgds,
Sunny



What happens behind this is each time a server side control creates a postback event first it executes the Page_Load event.

Hope this help you.

Rgds,
Sunny


这篇关于如何从表单将值保存到数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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