I have a List in C# for my Winforms application:
List<string> StudentSubjects = new List<>(string);
I have inserted these into List :
StudentSubjects.Add("Physics", "Chemistry", "Mathematics", "English");
Now i have a table: STUDENTS
----------
**StudentID | SubjectsSelected**
---------
STDNT001 | [HERE all subjects selected by the student should be inserted]
STDNT002 | Physics, Chemistry, Mathematics, English
STDNT002 | Physics, Chemistry, Mathematics, English
----------
Shall i use the implode function for MySql? But what's the syntax? Also , what to do for SQL Server.
I am doing:
string query =
"INSERT INTO STUDENTS VALUES
('S001', implode('" + StudentSubjects.ToArray() + " ')) "
But there's some error. Please help.