Ver Mensaje Individual
  #4 (permalink)  
Antiguo 22/02/2007, 18:25
Avatar de JonhyReyes
JonhyReyes
 
Fecha de Ingreso: febrero-2007
Mensajes: 103
Antigüedad: 17 años, 3 meses
Puntos: 1
Re: Problemas al guardar en la Bd

Y si vemos tu codigo asi

Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Try
Dim conexion As New OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0; Data Source=C:\Documents and Settings\SERVIDOR\Mis documentos\DataBase.mdb")
conexion.Open()
Dim sql = "Select *from Empleados"
Dim Ds As New DataSet
Dim Adapter As New OleDbDataAdapter(sql, conexion)
Dim Command As New OleDbCommandBuilder(Adapter)
Adapter.DeleteCommand = Command.getDeletecommand
Adapter.InsertCommand = Command.getInsertCommand
Adapter.UpdateCommand = Command.getUpdateCommand

Adapter.Fill(Ds)
Ds.Tables(0).NewRow.Item("Nombres") = TxtNombre.Text
Ds.Tables(0).NewRow.Item("Apellidos") = TxtApellidos.Text
Ds.Tables(0).NewRow.Item("Cedula") = TxtCedula.Text
Ds.Tables(0).NewRow.Item("Telefono") = TxtTelefono.Text
Ds.Tables(0).NewRow.Item("Direccion") = TxtDireccion.Text
Ds.Tables(0).NewRow.Item("Cargo") = TxtCargo.Text
Ds.Tables(0).NewRow.Item("Email") = TxtEmail.Text
Ds.Tables(0).NewRow.Item("Celular") = TxtCelular.Text
Ds.Tables(0).NewRow.Item("Libreta_No") = TxtLibreta.Text
Adapter.Update(Ds)
conexion.Close()
Catch ErrorException As Exception
MsgBox(ErrorException.Message, MsgBoxStyle.Exclamation, "Error en tiempo de ejecucion")
End Try
Clear()
End Sub

Lo que sucede es que el adapter necesita saber exactamente cual es la instruccion que debe enviar y de eso se encarga el command builder. Prueba con eso Camilo espero te sirva.

Saludos