Here's the code which tries to enter the data stored in the arrays. The arrays contain data as well as there are empty cells which need not be added into the database. The issue is the code is not throwing any exception or error but it isn't inserting any data in the database too! Please help... Thanks in advance
public void saveDb(string[,] timeTableId,string[,] start_time,string[,] end_time,string[,] subject_id,string[,] day,string[,] faculty_id)
{
SqlConnection con;
SqlCommand cmd;
con = new SqlConnection("Data Source=.;Initial Catalog=AIS;Integrated Security=True");
con.Open();
for (int i = 0; i < 8; i++)
{
for (int j = 1; j <= 7; j++)
{
if (subject_id[i, j].Length != 0 && subject_id[i, j] != null)
{
cmd = new SqlCommand("INSERT INTO TIMETABLE VALUES('" + subject_id[i, j] + "','" + day[i, j] + "','" + start_time[i, j] + "','" + end_time[i, j] + "','" + subject_id[i, j] + "','" + faculty_id[i, j] + "')", con);
cmd.ExecuteNonQuery();
}
else
{
}
}
}
con.Close();
}