Datagrid control

ei. i have a problem with the datagrid control, i could have it display records of database with this code.

connecttodatabase
set rsTest = new adodb.recordset
rstest.open "Select * from Table", conn,adOpenKeyset, adLockOptimistic

set datagrid1.datasource = rstest
datagrid1.refresh

the problem here is when i include the line conn.close at the end the datagrid control looses its content and doesn't display a thing.

is there a way to disconnect from the database after acquring or getting the records from the server? hope you guys could help me out :)
thanks
Mhyke

Comments

  • What I do is declare a datatable object in code, open my connection and recordset to the database, fill the datatable, close and destroy the connection and recordsets, and then set the datagrid's datasource property to the datatable object. Then you will have the records available and have the database disconnected.
  • thanks for the reply, i really appreciate it... but i am wondering how are you to create a datatable object, could you please somehow show me a code?

    regards


    : What I do is declare a datatable object in code, open my connection and recordset to the database, fill the datatable, close and destroy the connection and recordsets, and then set the datagrid's datasource property to the datatable object. Then you will have the records available and have the database disconnected.
    :

Sign In or Register to comment.

Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories