The following code is the minimal code required to create a DataSet from the SQL statement and attaches the dataset to a DataGrid using the AllHits sample data supplied with FlexODBC:
Dim cnDODBC As System.Data.Odbc.OdbcConnection Dim daDODBC As System.Data.Odbc.OdbcDataAdapter Dim dsDODBC As System.Data.DataSet
cnDODBC = New System.Data.Odbc.OdbcConnection("DSN=DataFlex Test32") cnDODBC.Open() daDODBC = New System.Data.Odbc.OdbcDataAdapter("SELECT Weeks, Title, Artist FROM AllHits order by Artist", cnDODBC) dsDODBC = New System.Data.DataSet
daDODBC.Fill(dsDODBC) dgDataGrid.DataSource = dsDODBC dgDataGrid.DataBind() 'May or maynot be required depending on where you put this code. |