Advertisement
Guest User

Untitled

a guest
Nov 21st, 2014
156
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.39 KB | None | 0 0
  1. Function Agregar_Registro(ByVal Id As String, ByVal Nombre As String, ByVal Direccion As String, ByVal Edad As String) As Boolean
  2. 'CONVETIR
  3. Dim COD As Integer = Convert.ToInt32(Id)
  4. 'CONEXION (CREA UN TIPO PUENTE DE CONNECCION ENTRE LA BBDD Y LA APLICCION)
  5. Dim Conexion As New OleDbConnection
  6. Conexion.ConnectionString = "provider=Microsoft.ACE.OLEDB.12.0;Data Source = F:Proyecto EmpresaProyecto Empresa BBDDBBDD Maestra.accdb; Persist Security info = false"
  7. Dim CadenaSql As String = "Insert into Personal(id, Nombre, Direccion, Edad) "
  8. CadenaSql = CadenaSql + "VALUES(" & COD & " , "
  9. CadenaSql = CadenaSql + " '" & Nombre & "' , "
  10. CadenaSql = CadenaSql + " '" & Direccion & "' , "
  11. CadenaSql = CadenaSql + " '" & Edad & "' ) "
  12. Dim Comando As OleDbCommand = Conexion.CreateCommand()
  13. Comando.CommandText = CadenaSql
  14. Conexion.Open()
  15. Comando.ExecuteNonQuery()
  16. Conexion.Close()
  17. Return True
  18. End Function
  19.  
  20. ID - Number
  21. Nombre - Text
  22. Direccion - Text
  23. Edad - Number
  24.  
  25. Dim CadenaSql As String = "Insert into Personal(id, Nombre, Direccion, Edad) "
  26. CadenaSql = CadenaSql + "VALUES(" & COD & " , "
  27. CadenaSql = CadenaSql + " '" & Nombre & "' , "
  28. CadenaSql = CadenaSql + " '" & Direccion & "' , "
  29. CadenaSql = CadenaSql + " '" & Edad & "' ) "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement