如何使用select into和insert into? [英] How to use select into and insert into?
本文介绍了如何使用select into和insert into?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
任何人都可以在示例后面给出一个代码,用于select into和insert into queries ..我知道如何在SQLserver中使用但不知道如何在文件后面的web应用程序代码中使用
我尝试了什么:
如何使用select into并插入查询
解决方案
您可以在正常的C#代码中使用它们作为SqlCommand字符串:
使用(SqlConnection con = new SqlConnection(strConnect))
{
con.Open();
使用(SqlCommand cmd = new SqlCommand( SELECT * INTO MyNewTable FROM myTable,con))
{
cmd.ExecuteNonQuery();
}
}
与任何其他SQL命令完全相同。
< blockquote> Google是你的朋友......
1. SQL SELECT INTO Statement [ ^ ]
2. SQL INSERT INTO Statement [ ^ ]
can anybody give an code behind example for select into and insert into queries..I know how to use in SQLserver but don't know how to use in a web application code behind file
What I have tried:
how to use select into and insert into queries
解决方案
You use use them as SqlCommand strings in your normal C# code:
using (SqlConnection con = new SqlConnection(strConnect)) { con.Open(); using (SqlCommand cmd = new SqlCommand("SELECT * INTO MyNewTable FROM myTable", con)) { cmd.ExecuteNonQuery(); } }
Exactly the same as you would for any other SQL command.
Google is your friend...
1. SQL SELECT INTO Statement[^]
2. SQL INSERT INTO Statement[^]
这篇关于如何使用select into和insert into?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文