Inserting a Record in Access database using tableAdapter.
-
Hi everyone, i'm a little bit stuck. :doh: While i was amazing myself discovering the dateset design wizard (which means that me querys methods will get waaaay shorter now :laugh:), i'm not able to insert a row in the Access database. I'm using a query to load a treeview, which works just fine:
private void GenerateTreeview() { treeView1.Nodes.Clear(); onAirDataSetTableAdapters.contenidoTableAdapter contAdap = new Loteria.onAirDataSetTableAdapters.contenidoTableAdapter(); DataTable tabla = contAdap.ObtenerDatos(); DataView dataViewHijos = new DataView(tabla); and so on.... }
now, i want to add a node on the treeview, and store that into the database table where I have my items. I tried this on a try/catch/finally, just to make sure i'm not getting any errors. I callgenerateTreeview()
function on finally, to reload my Treeview.try { onAirDataSetTableAdapters.contenidoTableAdapter contAdap = new Loteria.onAirDataSetTableAdapters.contenidoTableAdapter(); contAdap.InsertarCategoria(dlg.nombre, nodoPadretempID); } catch (OleDbException ode) { MessageBox.Show(ode.ToString(), "Error de Conexion con base de datos"); } catch (Exception er) { MessageBox.Show(er.ToString()); } finally { GenerateTreeview(); }
Everything works ok, i get the updated Treeview while running my app, but the database doesn't get updated. I restart the app and i get the same initial treeview, and of course, no changes are being performed on the mdb... PLEASE HELP!! thanks for eveyones time :omg: kiweed