Programación General > Visual Basic 6.0 e inferiores
[Artículo] Crear ODBC o DSN por codigos maximo nivel
toten:
explicame mejor tu error a ver s te lo resuelvo hijo.. salu2
Anónimo:
Cuando le especifico el usuario y el password no creal el dsn ¿por que?, como puedo especificarlos
toten:
por favor explicate mejor mandame un ejemplo
Anónimo:
Perdon por no ser tan claro, pero aqui esta el codigo, gracias.
Private Sub Command1_Click()
Dim dl As Long ' Valor devuelto por la función API
Dim sAttributes As String ' Aributos
Dim sDriver As String ' Nombre del controlador
Dim sDescription As String ' Descripción del DSN
Dim sDsnName As String ' Nombre del DSN
Dim sServidor As String ' Nombre del Servidor
Const ODBC_ADD_DSN As Long = 1 ' Se creará un DSN de Usuario
Const ODBC_ADD_SYS_DSN As Long = 4 ' Se creará un DSN de sistema
Const vbAPINull As Long = 0& ' Puntero NULL
' Establecemos los atributos necesarios
sDsnName = "Ejemplo_DSN_Sistema" ' Nombre del DSN
sDescription = "Nuevo DSN de sistema para SQL Server" ' Descripcion del DSN
sServidor = "RYSSERVER" ' Nombre del Servidor
sDriver = "SQL Server" ' Driver
sAttributes = "DSN=" & sDsnName & Chr(0)
sAttributes = sAttributes & "Server=" & sServidor & Chr$(0)
sAttributes = sAttributes & "Description=" & sDescription & Chr(0)
sAttributes = sAttributes & "Database=pubs" & Chr(0)
sAttributes = sAttributes & "Trusted_Connection=True" & Chr(0)
'sAttributes = sAttributes & "UID=sa" & Chr(0) AQUI ESPECIFICO EL USUARIO
'sAttributes = sAttributes & "PWD=" & Chr(0) AQUI ESPECIFICO EL PASSWORD
sAttributes = sAttributes & "Language=Spanish" & Chr(0)
dl = SQLConfigDataSource(vbAPINull, ODBC_ADD_SYS_DSN, sDriver, sAttributes)
'dl = SQLConfigDataSource(hWnd, ODBC_ADD_DSN, sDriver, sAttributes)
If dl Then
MsgBox "Se ha creado el DSN.", vbInformation
Else
MsgBox "No se ha podido crear el DSN."
End If
End Sub
toten:
mirap or lo que vi falta tu paswoord y y otros detalles agregame en tu msn para ver si te ayudo mas
yosoyfalo@hotmail.com
Navegación
[#] Página Siguiente
[*] Página Anterior
Ir a la versión completa