TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Israel
691
1.3k
219.5k
Doesnt send records from a Table to another Table
Dec 11 2018 2:45 PM
Hi,
I am sending a couple of records from one Table to another one. But when I run these codes its showing me in runtime a error message like this:
Additional information: Incorrect syntax near the keyword 'IN'.
I need to resolv this situation please.
string myConnectionString;
myConnectionString = "Data Source = (LocalDB)\\MSSQLLocalDB; AttachDbFilename = C:\\Copy_table_to_table\\WindowsFormsApplication1\\Database1.mdf; Integrated Security = True";
using (var con = new SqlConnection())
{
con.ConnectionString = myConnectionString;
con.Open();
using (var cmd = new SqlCommand())
{
cmd.Connection = con;
cmd.CommandType = System.Data.CommandType.Text;
cmd.CommandText = @"INSERT INTO
test2
IN 'C:\Copy_table_to_table\WindowsFormsApplication1\database1.mdb' " + @"SELECT * FROM
test1
";
cmd.ExecuteNonQuery();
}
con.Close();
}
Console.WriteLine("It's done!");
}
Reply
Answers (
4
)
Excel upload in .net core and Jquery
Query for c#...