在asp.net中选择insert命令 [英] select insert command in asp.net

查看:103
本文介绍了在asp.net中选择insert命令的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

单击按钮事件



i需要使用选择和插入命令。是否可以

如果可能请给我一个例子请

In single buttonclick event

i need to use a select and insert command .Is it possible
if possible send me an example please

推荐答案

您可以从一个表中选择一个值并将这些值插入另一个表中。



insert到tblname1([colname1,colname2,etc])值(从tblname2中选择[colname1,colname2等])



colname1,colname2等的值将是取自TABLE tblname2,将插入到table tblname1的colname1,colname2等中。



或改进您的问题,以帮助我们了解实际需要。
You can select a value from one table and insert those values in another table.

insert into tblname1([colname1, colname2, etc]) values(select [colname1,colname2, etc] from tblname2)

The values of colname1, colname2, etc will be taken from TABLE tblname2 and will be inserted into colname1, colname2, etc of TABLE tblname1

Or Improve your question for help us to understand what actually need.


是的,有可能,



在按钮单击事件中,您编写了一些使用连接和命令对象的代码,例如SQLCommand和SQLConnection(在System.Data命名空间中找到并构造适当的命令(理想情况下使用参数化查询)来发布东西t o您的基础数据库。
Yes it is possible,

In the button click event you write some code that uses connection and command objects, such as SQLCommand and SQLConnection (found in the System.Data namespace) and construct the appropriate command (ideally using parametrised queries) to post stuff to your underlying database.


这篇关于在asp.net中选择insert命令的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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