将值从gridview更新到数据库 [英] update values from gridview to database

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

问题描述

我的页面中有gridview,它显示了数据库中的数据.

我的问题是是否要更新数据库中的任何值,必须在数据库中对其进行更新.

我尝试了很多次,但是没有更新.

I have gridview in my page and it shows the datas from the database.

My question is if I update any values inside the database it must be updated in my database.

I tried many times but its not updating.

推荐答案

希望
Hope data-gridview-edit-delete-update-C-net[^]this might help you.


您是否打算将您在GridView中更改的值更新回数据库?如果这是您的意思,那么您需要创建一个事件来为您执行此操作,否则程序如何知道它应该执行某些操作?

最简单的方法是在页面上放置一个按钮并为其创建一个事件.一旦更改了网格中的数据,就需要按下该按钮以启动事件.在事件内部,您需要获取所有数据并将其传递回数据库.由于您已经启动了PostBack,因此页面将刷新,并且如果您已正确绑定控件,则应显示新数据.就像我说的那样,这非常简单,但是应该让您入门-一旦您熟悉并理解了这一点,就可以在代码中添加复杂性.试试看,如果遇到问题,请问另一个问题.
Do you mean to update the values that you have changed in the GridView back to the database? If that is what you meant then you need to create an event that will do this for you otherwise how does the program know that it should do something?

The simplest way to get you going is to drop a button on the page and create an event for it. Once you have changed data in the grid the button needs to be pressed to kick off the event. Inside the event you need to get all of the data and pass it back to the database. Since you have initiated a PostBack the page will refresh and, if you have properly bound the control, the new data should appear. As I said, that is very simplistic but should get you started - once you are comfortable with and understand this you can add sophistication to your code. Give it a try and if you get stuck ask another question.


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

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