手动更新表。 [英] Manually update table.

查看:57
本文介绍了手动更新表。的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,



我有一个gridview和sql数据源,我通过使用和SQl数据源使gridview可以编辑。

所以当我配置sql数据源时,我需要提供我想要加载和更新的sql表。如下所示代码将在aspx表单上生成为update命令。



UpdateCommand =

更新[产品] SET [ProductName] = @ ProductName,

[UnitPrice] = @UnitPrice,[已停产] = @Discontinued

WHERE [ProductID] = @ProductID>



我尝试了什么:



所以我关心的是,我想要显示和更新的表名动态变化。所以这种隐含的方式是不恰当的。因此,表名应该动态给出,并且应该为它生成更新命令。如果我不确定表名和字段,那么有人可以帮我找到更新整行gridview的更好方法吗?

表名我可以通过变量但是在写更新命令时我怎样才能提供字段?

有人关心我吗?

Hi All,

I have a gridview and sql datasource and i made the gridview editable via using and SQl datasource.
So when i am configuring the sql datasource i need to provide the sql table i want to load and update. Like below code would be generated on aspx form as update command.

UpdateCommand=
"UPDATE [Products] SET [ProductName] = @ProductName,
[UnitPrice] = @UnitPrice, [Discontinued] = @Discontinued
WHERE [ProductID] = @ProductID">

What I have tried:

So my concern is, my table name i want to display and update will change dynamically. So this implicit way is not proper. So the table name should given dynamically and update command should be generated for the same. So can anyone help me to find the better way of updating an entire row of gridview if i am not sure about the table name and fields?
Table name i can pass through a variable but while writing update command how can i supply fields?
anyone got my concern?

推荐答案

生成INSERT,UPDATE&的通用函数。删除Oracle SQL查询 [ ^ ]


这篇关于手动更新表。的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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