本文介绍了如何增加值并将该值插入数据库的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

查询如下



i有一个表格如下control_file



Query as follows

i have one table as follows control_file

ctrl_type   ctrl_last_no
 PKGNO         52





我有另一张表如下Co_Package_Master





I have another table as follows Co_Package_Master

cpm_pkg_id   pkg_name
 PKG00000     EFA+PSSR





首次查询如下



First Query as follows

Update control_file set ctrl_last_no = ctrl_last_no + 1 where ctrl_type = 'PKGNO'





第二个查询如下



Second Query as follows

select * from CONTROL_FILE where ctrl_type = 'PKGNO'





i从控制文件表中获取ctrl_last_nor并增加一个

i有Co_package_master表,我想插入cpm_pkg_id如下

PKG0000053



以上53 value已从控制文件中获取并增加一个值并希望存储在co_package_master表中。



我怎样才能在asp.net中使用c#。



i get the ctrl_last_nor from control file table and increment one
i have Co_package_master table in that i want to insert the cpm_pkg_id as follows
PKG0000053

The above 53 value has get from control file and increment one value and want to be store in the co_package_master table.

for that how can i do in asp.net using c#.

推荐答案

select top 1 ctrl_last_no from CONTROL_FILE where ctrl_type = 'PKGNO' order by ctrl_last_no desc.







比存储任何int变量而不是增量并插入另一个表中。或者你也可以为所有上述任务编写一个stroed程序/触发器(这是更好的方法)




than store it any int variable than increment and insert in another table . or you can also write a stroed procedure/trigger for all above tasks(which is better approach)


这篇关于如何增加值并将该值插入数据库的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

09-27 12:23