younis abdeljawwad

younis abdeljawwad

  • NA
  • 73
  • 94.8k

Error In adding to table !!

May 24 2012 3:10 PM
i try to insert to table data but an error Occurs ,,,,,my table name is "class time"

here is the code 

            int class_maxid = 17;
            int starttime = 95;
            int endtime = 200;
            string courseday = "saturday";
            //insert to the clas table the values
            SqlCommand cmd5 = new SqlCommand("INSERT INTO class time(class_id,start_from,end_to,day)Values(@cls_id,@s_from,@e_to,@d)", cn1);
            cmd5.Parameters.AddWithValue("@cls_id", class_maxid);
            cmd5.Parameters.AddWithValue("@s_from", starttime);
            cmd5.Parameters.AddWithValue("@e_to", endtime);
            cmd5.Parameters.AddWithValue("@d", courseday);
            cmd5.ExecuteNonQuery();

the error is    "Incorrect syntax near 'time'."

!!!!!!

Answers (2)