PDA

Click to See Complete Forum and Search --> : Datagrid and ADO


Nauj
Jan 18th, 2000, 06:56 PM
I want to fill a datagrid using a ADO Recordset I have opened previosly, but it doesn't work. That'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
----------------------
I have a data type error. (Type mismatch).

Can anybody help me?. Any advice will be greatly apreciatted.
Nauj

Maartin
Jan 18th, 2000, 07:11 PM
The only way that i found so far that worked for me it to do a manual load.

Using a loop.

Wait some more and somebody might have another suggestion that is easier to use.

------------------
Have Fun.
Maartin.
dinamite@onwe.co.za
-----------------------