82 lines
2.8 KiB
VB.net
82 lines
2.8 KiB
VB.net
|
Imports System.IO
|
||
|
Imports CLIENTE.dmModulo
|
||
|
|
||
|
Public Class LeeEditorRegistro
|
||
|
|
||
|
Public Sub LEE(ByVal sAmbienteConexion As String)
|
||
|
|
||
|
Dim StrMFile As System.IO.FileStream
|
||
|
Dim StrMRead As System.IO.StreamReader
|
||
|
Dim strLocation As String = ""
|
||
|
Dim strCtlCadena As String = String.Empty
|
||
|
Dim strValorRead As String = String.Empty
|
||
|
|
||
|
Dim StrBasedatos As String = String.Empty
|
||
|
Dim StrPassword As String = String.Empty
|
||
|
Dim StrServidor As String = String.Empty
|
||
|
Dim StrTipoSer As String = String.Empty
|
||
|
Dim StrUsuario As String = String.Empty
|
||
|
Dim strFile As String = String.Empty
|
||
|
Try
|
||
|
strLocation = Application.StartupPath & "\Conexion_MindsOP.ini"
|
||
|
strFile = strLocation
|
||
|
If Dir(strFile) <> "" Then
|
||
|
StrMFile = New System.IO.FileStream(strFile, IO.FileMode.Open, IO.FileAccess.Read)
|
||
|
StrMRead = New System.IO.StreamReader(StrMFile)
|
||
|
Do While StrMRead.Peek >= 0
|
||
|
strCtlCadena = StrMRead.ReadLine.ToString
|
||
|
strValorRead = strCtlCadena.Trim.Substring(0, 3).ToUpper
|
||
|
Select Case strValorRead
|
||
|
Case "BAS"
|
||
|
StrBasedatos = BuscaValores(strCtlCadena, "=")
|
||
|
Case "PAS"
|
||
|
StrPassword = BuscaValores(strCtlCadena, "=")
|
||
|
Case "SER"
|
||
|
StrServidor = BuscaValores(strCtlCadena, "=")
|
||
|
Case "TIP"
|
||
|
StrTipoSer = BuscaValores(strCtlCadena, "=")
|
||
|
Case "USU"
|
||
|
StrUsuario = BuscaValores(strCtlCadena, "=")
|
||
|
End Select
|
||
|
Loop '
|
||
|
StrMRead.Close()
|
||
|
StrMFile.Close()
|
||
|
End If
|
||
|
dmModulo.CadenaConexion(StrTipoSer, StrServidor, StrBasedatos, StrUsuario, Registro.DesEncripta(StrPassword))
|
||
|
strConnection = dmModulo.strConnection
|
||
|
Catch ex As Exception
|
||
|
MessageBox.Show("Error al intentar conectarse ... " & ex.Message)
|
||
|
End Try
|
||
|
End Sub
|
||
|
|
||
|
Public Sub LeeNombre_BD_Servidor()
|
||
|
|
||
|
End Sub
|
||
|
|
||
|
Public Function BuscaValores(ByVal Cadena As String, ByVal strDelimited As String) As String
|
||
|
Dim ArrBuscaVal As System.Array
|
||
|
|
||
|
Try
|
||
|
|
||
|
If Cadena <> "" Then
|
||
|
|
||
|
ArrBuscaVal = Cadena.Trim.Split(strDelimited)
|
||
|
|
||
|
BuscaValores = ArrBuscaVal(1)
|
||
|
|
||
|
End If
|
||
|
|
||
|
Catch
|
||
|
MsgBox(Err.Number & ": " & Err.Description & Chr(13) & "Fallo la conexion....Verifique sus propiedades", MsgBoxStyle.Critical)
|
||
|
End Try
|
||
|
|
||
|
End Function
|
||
|
|
||
|
|
||
|
Public Function cad(ByVal sAmbienteConexion As String) As String
|
||
|
LEE(sAmbienteConexion)
|
||
|
Return strConnection
|
||
|
End Function
|
||
|
|
||
|
End Class
|