in C sharp, modify records in an Access database (version 97) using
Here I write the ODE to modify a record using the same tools and same lois seus métdos that to make the article inserckión In C sharp, insert records into an Access database (version 97) using the ODBC libraries
As in the previous, I import the following libraries:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Data;
using System.Data.OleDb;
and work in class Type.
Without further ado here is the code to modify a record.
public void ModificarTipoExistente (Type _tipo) {
DatosConexionABaseDeDatos odatosConexion = new DatosConexionABaseDeDatos ();
odatosConexion.getConexion OleDbConnection connection = (); UpdateSQL
string = "UPDATE SET Description Type = '" + _tipo.descripcion + "', Type = '" + _tipo.tipo + "' WHERE IdTipo = "+ _tipo.id;
conexion.Open ();
oAdaptador OleDbDataAdapter = new OleDbDataAdapter (UpdateSQL, conn);
OleDbCommandBuilder oBuilder = new OleDbCommandBuilder (oAdaptador)
DataSet oDsTipo = new DataSet ("Type");
oAdaptador.Fill (oDsTipo, "Type");
conexion.Close ();
}
This maintains differences with his successor, as they never targeted all fields, and instead run a UPDATE statement. You can save the lines where we created a Row object added as new, because obviously this does not add but that updates records that already exist.
0 comments:
Post a Comment