Ver Mensaje Individual
  #3 (permalink)  
Antiguo 05/12/2011, 07:47
Avatar de yamiblancoc
yamiblancoc
 
Fecha de Ingreso: agosto-2011
Mensajes: 103
Antigüedad: 12 años, 8 meses
Puntos: 4
Respuesta: Leer archivo .ini

hola, bueno gracias pero ya habia resuelto utilice

Código Visual Basic:
Ver original
  1. Public Sub Toma_registro()
  2.  
  3.  
  4.  Dim Aux_clave As String
  5.  Dim Aux_usuario As String
  6.    
  7.     Dim variable, StrVar As String
  8.     Open App.Path & "\SIPRE.ini" For Input As #1
  9.  
  10.     Do While Not EOF(1)
  11.       Line Input #1, variable
  12.       StrVar = Trim(Mid(variable, 1, 7))
  13.       If StrVar = "server=" Then
  14.          Server = Trim(Mid(variable, 8, 15))
  15.       End If
  16.      
  17.        
  18.       StrVar = Trim(Mid(variable, 1, 7))
  19.       If StrVar = "datos2=" Then
  20.          datos2 = Trim(Mid(variable, 8, 15))
  21.       End If
  22.  
  23.       StrVar = Trim(Mid(variable, 1, 7))
  24.       If StrVar = "datos3=" Then
  25.          datos3 = Trim(Mid(variable, 8, 15))
  26.       End If
  27.      
  28.  
  29.       Loop
  30.  
  31.  
  32.  
  33.  'bdatos2 = "driver={Sql Server};server=" & Trim(BD_servidor) & ";Uid=" & Trim(BD_usuario) & ";Pwd=" & Trim(BD_clave) & ";Database=" & Trim(BD_nombre)
  34.   bdatos2 = "driver={Sql Server};server=" & Server & ";Uid=" & "sa" & ";Pwd=" & "pwd" & ";Database=" & datos2
  35.  'bdatos2 = "driver=(Sql Server);server=" & "localhost" & ";Uid=" & "sa" & ";Pwd=" & "pwd" & ";Database=" & "SIPRE"
  36.  
  37. tipo_datos1 (bdatos2)
  38.  
  39.  
  40.  'bdatos3 = "driver={Sql Server};server=" & Trim(BD_servidor) & ";Uid=" & Trim(BD_usuario) & ";Pwd=" & Trim(BD_clave) & ";Database=" & Trim(BD_nombre)
  41.   bdatos3 = "driver={Sql Server};server=" & Server & ";Uid=" & "sa" & ";Pwd=" & "pwd" & ";Database=" & datos3
  42.  'bdatos3 = "driver=(Sql Server);server=" & "localhost" & ";Uid=" & "sa" & ";Pwd=" & "pwd" & ";Database=" & "SIPR"
  43.  
  44. tipo_datos1 (bdatos3)
  45.  
  46.  
  47. End Sub

y funciona perfectamente