Page 1 of 1

Problems with datagrid

Posted: Sun 15 Jan 2006 12:41
by abraiante
Hello:

I'm using mysqldirect 2.80 with visual studio.net 2003 edition.

i'm using this code to view the result of a query in a datagrid component, as one person told in other thread of this forum, exactly in http://www.crlab.com/forums/viewtopic.p ... t=datagrid.


Code: Select all

Private Sub btngenerar_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btngenerar.Click
        Dim myDataTable As CoreLab.MySql.MySqlDataTable = New CoreLab.MySql.MySqlDataTable("SELECT * FROM operadoras", "User Id=***;password=***;Host=***;Database=***")
        Try
            DataGrid1.DataSource = myDataTable
            myDataTable.Active = True
        Finally
            myDataTable.Active = False
        End Try

    End Sub
In datagrid i only view the name of columns, but there isn't rows in it.

Anybody can help me?

Thanks to everybody and sorry for my english

Posted: Mon 16 Jan 2006 12:35
by Serious
As described in MySqlDataTable.Active property documentation
Setting the property to false clears the data and frees the memory.
Hence when you in your code set this property to true data is populated from database, and when you set it to false (in finally block) data is cleared.

For more information about MySqlDataTable component please refer to its documentation and corresponding demo projects.

Thanks

Posted: Mon 16 Jan 2006 13:12
by abraiante
Thanks a lot for the answer.

It works fine now.