Click here to Skip to main content
15,883,905 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
SQL
con.Open();
                command = new OleDbCommand("INSERT INTO Attendance [StudNum,SubjCode,schedconcat] SELECT StudNum, SubjCode, schedconcat FROM Enlistment [where schedconcat=? AND P=?]", con);
                command.Parameters.AddWithValue("?", lblsched.Text);
                command.Parameters.AddWithValue("?", false);
                adapter.SelectCommand = command;
                adapter.InsertCommand = command;
                command.ExecuteNonQuery();
                con.Close();

Posted

syntax is
SQL
INSERT INTO table2
(column_name(s))
SELECT column_name(s)
FROM table1

so try
SQL
INSERT INTO Attendance 
(StudNum,SubjCode,schedconcat)
SELECT StudNum,SubjCode,schedconcat
FROM Enlistment 
WHERE schedconcat=? AND P=?
 
Share this answer
 
it's just that...Thanks DamithSL
 
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