I have verbatim string that have some variables contacanete with, my problem I always get this error from the compiler:
; expected
So how I can escape it properly?
int teacherId = sqlStatus = (int)sqlCmd.LastInsertedId;
sqlCmd.CommandText = @"INSERT INTO report (report_type, report_date, semester, report_details, teacher_id)
VALUES (0, ""2018-01-01"", 1, '{
""teacherId"": "" " + teacherId.ToString() + " "", <=== error here (; expected)
""mahderDate"": """",
""teacherShool"": """",
""baladia"": """",
""wilaya"": """",
""moufatecheReport"": """"
}'," + teacherId + ");";
Using @poke suggestion I managed to get it work with placing a double quote and @ in the line:
int teacherId = sqlStatus = (int)sqlCmd.LastInsertedId;
sqlCmd.CommandText = @"INSERT INTO report (report_type, report_date, semester, report_details, teacher_id)
VALUES (0, ""2018-01-01"", 1, '{
""teacherId"": "" " + teacherId.ToString() + "," +
@" ""mahderDate"": """",
""teacherShool"": """",
""baladia"": """",
""wilaya"": """",
""moufatecheReport"": """"
}'," + teacherId + ");";