5
Answers

How can I insert at the first line into my database

Israel

Israel

7y
258
1
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)