insert data in an access db with C# (update)

J

Jordi Maicas

I've got the problem that after doing an INSERT, I can't see the new records
in my database.

What can I force an UPDATE, before close the databse?

Thanks.

Now, I'm doing...

String evento = "1";

String suceso = "actualizacion";

String fecha = System.DateTime.Now.ToString();

String usuario = "user";



OleDbConnection myConn = new
OleDbConnection(TabStripApp.Properties.Settings.Default.onlydentConnectionString);

String cadena="insert into Log (Tipo_evento,Suceso,Fecha,Usuario) values
('"+evento+"','"+suceso+"','"+fecha+"','"+usuario+"')";

OleDbCommand myComm = new OleDbCommand(cadena, myConn);


myConn.Open();

myComm.ExecuteNonQuery();


myConn.Close();
 
J

Jordi Maicas

Solved.. jejej (the problem was that vs.net 2008 put 3 mdb, in
release,debug,project,etc,etc,and I was looking the wrong .mdb)

private void button4_Click(object sender, EventArgs e)

{

/* abrir la base datos

* la tabla log

* y añadir una entrada con fecha,hora,usuario y la accion

*/

String evento = "1";

String suceso = "actualizacion";

String fecha = System.DateTime.Now.ToString();

String usuario = "user";

OleDbConnection myConn = new
OleDbConnection(TabStripApp.Properties.Settings.Default.onlydentConnectionString);

String cadena="insert into Log (Tipo_evento,Suceso,Fecha,Usuario) values
('"+evento+"','"+suceso+"','"+fecha+"','"+usuario+"')";

OleDbCommand myComm = new OleDbCommand(cadena, myConn);


myConn.Open();

myComm.ExecuteNonQuery();

logTableAdapter.Update(log);




myConn.Close();



}
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top