Click here to Skip to main content
15,914,594 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
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
Posted
Updated 22-Feb-17 23:09pm
Comments
Graeme_Grant 23-Feb-17 5:09am    
These Quick Answers forum is to help you if you are stuck, not for us to train you or write your code.

Once you have tried, and you are stuck, post a detailed question with sample code and where you are stuck. Then we can help you by pointing you in the right direction.
GrpSMK 23-Feb-17 6:26am    
ok sure

You use use them as SqlCommand strings in your normal C# code:
C#
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.
 
Share this answer
 
Comments
GrpSMK 23-Feb-17 5:14am    
Thank you
OriginalGriff 23-Feb-17 5:26am    
You're welcome!
Google is your friend...

1. SQL SELECT INTO Statement[^]

2. SQL INSERT INTO Statement[^]
 
Share this answer
 

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900