|
-
January 20th, 2000, 05:10 AM
#1
Datagrid and ADO recordset
I want to fill a datagrid using a ADO Recordset I have opened
previosly, but it doesn't work. Thhat's my code:
------------------------
Option Explicit
Public cnnoddo2 As ADODB.Connection
Public rstactivos As ADODB.Recordset
Private Sub Cmdrellenar_Click()
Dim Sql_activo As String
Set rstactivos = New ADODB.Recordset
Sql_activo = "SELECT activo FROM activo_subyacente"
rstactivos.Open Sql_activo, cnnoddo2, adOpenDynamic,
adLockOptimistic
Set DataGrid1.DataSource = rstactivos
End Sub
Private Sub Form_Load()
Dim strconexion As String
Set cnnoddo2 = New ADODB.Connection
strconexion
= "ODBC;DATABASE=ODDO;DSN=odbcoddo2;UID=sa" 'cadena de conexión
cnnoddo2.Open strconexion
End Sub
----------------------
Can anybody help me?. Any advice will be greatly apreciatted.
Nauj
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|