i have error in query i am not getting what is the issue in the query probably i am not following the correct way to put the string and char sign , i am inserting the data in c# to local host with where clause please check the query and Error i am getting 

String insertQuery = "insert into exam_add (id,session_id,Title,From_date,To_date,class_id,is_Post,is_Lock) select '"+id+ ",s.session,'" + title.Text+",'"+ from.Value.Date.ToString("yyyy-MM-dd")+",'"+to.Value.Date.ToString("yyyy-MM-dd")+ ", c.class_name,'"+x+",'"+x+" from year_session s, classes c where s.id = '1' and c.id='" + cls + "'";


Error
If you add static strings to your SELECT Statement you always have to surround them on both sides with single ticks.

But you should urgently consider prepared statements like
https://docs.microsoft.com/de-de/dotnet/api/system.data.sqlclient.sqlcommand.prepare?view=netframework-4.8

String insertQuery = "insert into exam_add
  (id,session_id,Title,From_date,To_date,class_id,is_Post,is_Lock) 
select 
   '"+id+ "'
   ,s.session
   ,'" + title.Text+"'
   ,'"+ from.Value.Date.ToString("yyyy-MM-dd")+"'
   ,'"+to.Value.Date.ToString("yyyy-MM-dd")+ "'
   , c.class_name
   ,'"+x+"'
   ,'"+x+"' 
 from year_session s, classes c 
 where s.id = '1' and c.id='" + cls + "'";