-
Notifications
You must be signed in to change notification settings - Fork 0
/
ReMe_DB.vb
39 lines (37 loc) · 1.25 KB
/
ReMe_DB.vb
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
Imports MySql.Data.MySqlClient
Public Class ReMe_DB
Private ReadOnly nombreDB As String = "reme"
Private ReadOnly hostname As String = "127.0.0.1"
Private ReadOnly UsuarioDB As String = "root"
Private ReadOnly miConexion As New MySqlConnection
Public miComando As New MySqlCommand
Public miDataAdapter As New MySqlDataAdapter
Public miDataSet As New DataSet
Public Conexion_Error As String
Public reader As MySqlDataReader
Public Sub New()
Try
miConexion.ConnectionString = $"server={hostname};database={nombreDB};Uid={UsuarioDB};"
miConexion.Open()
miComando.Connection = miConexion
Conexion_Error = ""
Catch ex As Exception
Conexion_Error = ex.Message
MsgBox("Error en el connection string")
End Try
End Sub
Public ReadOnly Property Database()
Get
Return nombreDB
End Get
End Property
Public Sub EjecutarSQL(SentenciaSQL As String)
miComando.CommandText = SentenciaSQL
miComando.ExecuteNonQuery()
End Sub
Public Sub Dispose()
miConexion.Close()
miConexion.Dispose()
miComando.Dispose()
End Sub
End Class