Israel

Israel

  • 701
  • 1.3k
  • 217.2k

How can I insert at the first line into my database

Jan 25 2017 9:19 AM
Hi!
 
I need to try something I never tryied before.
With these codes I can insert records ONLY at the end of my database.
But I would like to learn how can I insert one row as the first row among all the rows.
 
if (conn.State != ConnectionState.Open)
conn.Open();

OleDbParameter data = new OleDbParameter("@data", OleDbType.VarChar);
OleDbParameter qde = new OleDbParameter("@qde", OleDbType.VarChar);
OleDbParameter descritivo = new OleDbParameter("@descritivo", OleDbType.VarChar);

comm.Parameters.Add(data);
comm.Parameters.Add(qde);
comm.Parameters.Add(descritivo);

data.Value = "0";
qde.Value = "0";
descritivo.Value = "-";

comm.Connection = conn;

//comm.CommandText = "insert into facturacao ([data],[qde],[descritivo]) values(@data,@qde,@descritivo)";
comm.CommandText = "insert into mesa1 ([data],[qde],[descritivo]) values(@data,@qde,@descritivo)";

comm.ExecuteNonQuery();
{
conn.Close();

Answers (5)