SoloCodigo
Programación General => Visual Basic 6.0 e inferiores => Mensaje iniciado por: RadicalEd en Sábado 20 de Noviembre de 2004, 17:39
-
HOLA CHICOS DE SOLOCODIGO, COMO A MI NO ME GUSTAN CASI LAS DB, PERO VEO QUE TODO EL MUNDO NO HACE SINO PREGUNTA ACERCA DE ESTAS Y YO NO COLABORO :( ; 'TONCES ME VOY A DARLE A ESTO, POR ESO TENGO UNA CUESTION.
MANEJO UNAS DB EN MySQL O EN SQL NO IMPORTA (NO ACCESS).
¿COMO HAGO PARA CONECTARLAS A VB6?
POR FA SI NOMBRAN ADO O DAO, EXPLIQUENMEN POR QUE DE ESTO NO SE NADITA NADITA.
DE ANTEMANO MUCHAS LAS GRACIAS.
CHAO
-
Public Sub Opendb(Optional pstrBD As String)
Dim strBD As String
Dim strServidor As String
On Error GoTo Err_
If Trim(pstrBD) = "" Then
strBD = "BD_XXXXXX" 'NOMBRE DE LA BD
Else
strBD = pstrBD
End If
Set DB = New ADODB.Connection
'Estas variables contienen los datos necesarios para la conexion.
strServidor = "SERVIDOR"
DB.Open ("Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;Data Source=" & strServidor & ";Initial Catalog=" & strBD)
Exit Sub
Err_:
MsgBox Err.Description, vbInformation, "ERROR DE CONEXION A LA BASE DE DATOS"
End Sub