Visual Basic - DSN

Life is soft - evento anual de software empresarial
 
Vista:

DSN

Publicado por María Fernanda (12 intervenciones) el 27/06/2002 17:56:20
Hola a Todos, alguien me puede explicar como creo un dsn

De ante mano muchisimas gracias
Valora esta pregunta
Me gusta: Está pregunta es útil y esta claraNo me gusta: Está pregunta no esta clara o no es útil
0
Responder

RE:DSN

Publicado por JK (23 intervenciones) el 27/06/2002 22:38:11
supongo que es por VB

usa la libreria odbccp32.dll

declarala
Declare Function SQLConfigDataSource Lib "odbccp32.dll" (ByVal hwndParent As Long, ByVal fRequest As Integer, ByVal lpszDriver As String, ByVal lpszAttributes As String) As Long

luego la creas y/o modificas

strDSNString = ""
strDSNString = strDSNString & "DSN=" & strDSN & Chr(0)
strDSNString = strDSNString & "DESCRIPTION=" & "Conexión Creada por Programa (" & App.EXEName & ")- " & CStr(Now) & Chr(0)
strDSNString = strDSNString & "Server=" & strServerName & Chr(0)
strDSNString = strDSNString & "DATABASE=" & strDBName & Chr(0)
strDSNString = strDSNString & Chr(0)

If Not CBool(SQLConfigDataSource(0&, 1, "SQL Server", strDSNString)) Then
boolError = True
MsgBox "Error al preparar DSN", vbExclamation
Exit Function
End If

espero te ayude
Saludos

JK
Valora esta respuesta
Me gusta: Está respuesta es útil y esta claraNo me gusta: Está respuesta no esta clara o no es útil
0
Comentar