SQL - Conexion

 
Vista:

Conexion

Publicado por Mary (2 intervenciones) el 09/01/2002 00:11:00
Alguien me podria mandar un pequeño codigo de conexion entre SQL 7 y Visual Basic 6 porque no me puedo conectar.

Se los voy a agradecer bastante
Gracias y Saludos
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:Conexion

Publicado por xavi lopez miñarro (10 intervenciones) el 17/01/2002 09:48:43
public SQLCnn as adodb.connection
public AdoRs as adodb.recordset

Private Function Conexion() As Boolean
Set SQLCnn = CreateObject("adodb.connection")
SQLCnn.Provider = "sqloledb"
SQLCnn.Properties("user ID") = ""
SQLCnn.Properties("password") = ""
SQLCnn.Properties("integrated security") = "SSPI"
SQLCnn.Properties("persist security info") = False
SQLCnn.Properties("data source") = "SQL-SERVER"
SQLCnn.Properties("initial catalog") = AppBD
SQLCnn.CursorLocation = adUseServer
Call SQLCnn.Open
Conexion=CBool(SQLCnn.State = 1)
End Function

public sub Consulta()
'Abre un recordset de sólo lectura.
Set AdoRsE = CreateObject("adodb.recordset")
Set AdoRsE.ActiveConnection = SQLCnn
AdoRsE.CursorLocation = adUseServer
AdoRsE.CursorType = adOpenForwardOnly
AdoRsE.LockType = adLockReadOnly
Call AdoRsE.Open("Select * from tabla o vista")

If AdoRsE.State = 1 Then
'Visualiza los registros.
While Not AdoRsE.EOF
...
Call AdoRsE.MoveNext
DoEvents
Wend
End If
end

Si tienes más dudas utiliza mi correo
un saludo mari
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