Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Function Agregar_Registro(ByVal Id As String, ByVal Nombre As String, ByVal Direccion As String, ByVal Edad As String) As Boolean
- 'CONVETIR
- Dim COD As Integer = Convert.ToInt32(Id)
- 'CONEXION (CREA UN TIPO PUENTE DE CONNECCION ENTRE LA BBDD Y LA APLICCION)
- Dim Conexion As New OleDbConnection
- Conexion.ConnectionString = "provider=Microsoft.ACE.OLEDB.12.0;Data Source = F:Proyecto EmpresaProyecto Empresa BBDDBBDD Maestra.accdb; Persist Security info = false"
- Dim CadenaSql As String = "Insert into Personal(id, Nombre, Direccion, Edad) "
- CadenaSql = CadenaSql + "VALUES(" & COD & " , "
- CadenaSql = CadenaSql + " '" & Nombre & "' , "
- CadenaSql = CadenaSql + " '" & Direccion & "' , "
- CadenaSql = CadenaSql + " '" & Edad & "' ) "
- Dim Comando As OleDbCommand = Conexion.CreateCommand()
- Comando.CommandText = CadenaSql
- Conexion.Open()
- Comando.ExecuteNonQuery()
- Conexion.Close()
- Return True
- End Function
- ID - Number
- Nombre - Text
- Direccion - Text
- Edad - Number
- Dim CadenaSql As String = "Insert into Personal(id, Nombre, Direccion, Edad) "
- CadenaSql = CadenaSql + "VALUES(" & COD & " , "
- CadenaSql = CadenaSql + " '" & Nombre & "' , "
- CadenaSql = CadenaSql + " '" & Direccion & "' , "
- CadenaSql = CadenaSql + " '" & Edad & "' ) "
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement