使用asp.net中的数据源控件进行更新

时间:2022-02-08 14:49:16

How do you run an update query in a data source control from a button? I have the data source control with the update query configured in it. I just don't know what to put in the button_click event to make it run.

如何从按钮在数据源控件中运行更新查询?我有数据源控件,其中配置了更新查询。我只是不知道在button_click事件中放入什么以使其运行。

3 个解决方案

#1


1  

In the event handler just call the Update method for your Datasource control.

在事件处理程序中,只需为数据源控件调用Update方法。

#2


1  

aha I needed parenthesis after the update command

啊哈我在更新命令后需要括号

sdsUpdateName.Update();

#3


-1  

I get an error when I call the Update method of the Datasource

当我调用Datasource的Update方法时出错

sdsUpdateName.Update;

Only assignment, call, increment, decrement, and new object expressions can be used as a statement

只有赋值,调用,递增,递减和新对象表达式才能用作语句

#1


1  

In the event handler just call the Update method for your Datasource control.

在事件处理程序中,只需为数据源控件调用Update方法。

#2


1  

aha I needed parenthesis after the update command

啊哈我在更新命令后需要括号

sdsUpdateName.Update();

#3


-1  

I get an error when I call the Update method of the Datasource

当我调用Datasource的Update方法时出错

sdsUpdateName.Update;

Only assignment, call, increment, decrement, and new object expressions can be used as a statement

只有赋值,调用,递增,递减和新对象表达式才能用作语句