Escolar Documentos
Profissional Documentos
Cultura Documentos
limpiar
Dim con As New ADODB.Connection
Dim rs As New ADODB.Recordset
Dim ConnectionString As String
Dim sql As String
con.Open ConnectionsStringMySQL
con.CommandTimeout = 900
Sheets(1).Range("A2").CopyFromRecordset rs
rs.Close
con.Close
End Sub
Sub limpiar()
Range("A2:E1048576").Select
Selection.ClearContents
Range("A2").Select
End Sub
-------------------------------------------
Sub insertar_mysql()
con.Open ConnectionsStringMySQL
con.CommandTimeout = 900
sql = "INSERT INTO alumnos VALUES ('" & Cells(2,1)' & "','" Cells(2,2)' & ",'"
Cells(2,3)&"');"
Sheets(1).Range("A2").CopyFromRecordset rs
rs.Close
con.Close
End Sub
--------------------------------------
Sub actualizar_mysql()
con.Open ConnectionsStringMySQL
con.CommandTimeout = 900
sql = "UPDATE alumnos SET id='" & Cells(4, 1) & "', nombre='" & Cells(4, 2) &
"',apellidos=rs.Open sql, con"
Sheets(1).Range("A2").CopyFromRecordset rs
rs.Close
con.Close
End Sub
----------------------------------------------------
Sub eliminar_mysql()
con.Open ConnectionsStringMySQL
con.CommandTimeout = 900
sql = "DELETE FROM alumnos WHERE id='" & Cells(2, 1) & "'"
rs.Open sql, con
Sheets(1).Range("A2").CopyFromRecordset rs
rs.Close
con.Close
End Sub
Sub desaparecer()
Range("A2:E2").Select
With Selection.Font
.ThemeColor = xlThemeColorDarki
.TintAndShade = 0
End Sub