Private Sub cmdRegister_Click()
Dim registro As String
Dim msg As String
Dim ann As String
Dim Obj As EncriptString
Set Obj = New EncriptString
Dim lNumRegAfect As Long
Dim strSQL As String
Set conectar = New ADODB.Connection
Set registro = New ADODB.Recordset
On Error Resume Next
'Path del fichero Ini
Path_Archivo_Ini = App.Path & "\config.ini"
'Lee los datos y Les envia el valor por defecto por si no existe
account = Leer_Ini(Path_Archivo_Ini, "user", "sa")
password = Leer_Ini(Path_Archivo_Ini, "pass", "123")
ann = Obj.descifrar(password)
msg = MsgBox("Estas a punto de registrar una cuenta con los siguientes datos: " & vbCrLf _
& "Nombre de usuario: " & txtNickname & vbCrLf _
& "Password: " & txtPassword & vbCrLf _
& "Correo Electronico: " & txtEmail & vbCrLf _
, vbInformation + vbYesNo, "Info")
If msg = vbYes Then
Set conectar = New ADODB.Connection
Set registro = New ADODB.Recordset
conectar.Open "PROVIDER=MSDASQL;" & _
"driver={SQL Server};" & _
"server=(local);" & _
"uid=" & account & ";" & _
"pwd=" & ann & ";" & _
"database=users;"
registro = "INSERT INTO info(id,pwd,mail)" & _
"VALUES('" & txtNickname & "', '" & _
txtPassword & "', '" & _
txtEmail & "')"
conectar.Execute registro, lNumRegAfect
MsgBox "Cuenta registrada satisfactoriamente", vbInformation, "Info"
MsgBox "Número de registros afectados: " & lNumRegAfect
conectar.Close
Else
Exit Sub
conectar.Close
registro.Close
Unload Me
End If
End Sub