Consider this code:
public void Insertindb(int chnlNm, string Date, string Time, string Progname)
{
DbConnection db = new DbConnection();
db.connectionOpen();
SqlCommand cmd = new SqlCommand("INSERT INTO dbo.SchedulProgram (ChannelNumber,Date,Time,ProgramName) VALUES(@chnlNm,@date,@time,@progname)", db.con);
cmd.Parameters.Add(new SqlParameter("@chnlNm", chnlNm));
cmd.Parameters.Add(new SqlParameter("@date",Date));
cmd.Parameters.Add(new SqlParameter("@time", Time));
cmd.Parameters.Add(new SqlParameter("@progname", Progname));
Console.WriteLine("{0} {1} {2} {3}",chnlNm,Date,Time,Progname);
cmd.ExecuteNonQuery();
db.connectionClose();
}
I use this code to insert data in a table. It inserts data in a table. When I call the function multiple times,
sdb.Insertindb(channelno, date, time, programname)
It randomly inserts data in the table not in sequence. I want it to insert data in sequence. How is it possible?
since your inserting the date and time, is that the order of what your refer to as 'row after row'?
if so, the simple solution would be to select ordered by those columns?