Código para Guardar en la Base de Datos Imports System.Data Imports System.Data.OleDb Public Class frmGuardar Dim conexion As New OleDbConnection Dim comandos As New OleDbCommand Private Sub frmGuardar_Load(sender As Object, e As EventArgs) Handles MyBase.Load Try conexion.ConnectionString = "Provider=Microsoft.ACE.OLEDB.12.0;Data source=cefit.accdb" conexion.Open() MsgBox("Conexion BD Exitosa") llenargrid() Catch ex As Exception MsgBox("Error en la conexion", vbCritical, "Sin Conexion") End Try End Sub Private Sub limpiar() txtCedula.Clear() txtApellidos.Clear() txtNombres.Clear() txtTelefono.Clear() txtDireccion.Clear() txtEmail.Clear() txtCedula.Focus() End Sub Private Dim Dim Dim Sub llenargrid() adaptador As New OleDbDataAdapter registros As New DataSet consulta As String consulta = "SELECT * FROM DatosP" adaptador = New OleDbDataAdapter(consulta, conexion) registros.Tables.Add("DatosP") adaptador.Fill(registros.Tables("DatosP")) dgvDatos.DataSource = registros.Tables("DatosP") End Sub Private Sub BtnGuardar_Click(sender As Object, e As EventArgs) Handles BtnGuardar.Click Try comandos = New OleDbCommand("INSERT INTO DatosP(Cedula,Apellidos,Nombres,Telefono,Direccion,Email) VALUES(txtCedula,txtApellidos,txtNombres,txtTelefono,txtDireccion,txtEmail)", conexion) comandos.Parameters.AddWithValue("Cedula", txtCedula.Text) comandos.Parameters.AddWithValue("Apellidos", txtApellidos.Text) comandos.Parameters.AddWithValue("Nombres", txtNombres.Text) comandos.Parameters.AddWithValue("Telefono", txtTelefono.Text) comandos.Parameters.AddWithValue("Direccion", txtDireccion.Text) comandos.Parameters.AddWithValue("Email", txtEmail.Text) comandos.ExecuteNonQuery() MsgBox("El registro se guardo correctamente", vbInformation, "Exito!!!") llenargrid() Catch ex As Exception MsgBox("No se pudo Guardar el registro", vbCritical, "Error") End Try End Sub Private Sub btnLimpiar_Click(sender As Object, e As EventArgs) Handles btnLimpiar.Click limpiar() End Sub End Class