Results 1 to 4 of 4

Thread: datagrid?

  1. #1

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773

    datagrid?

    How do i view the results of a table in a datagrid or dataresult? What do i do?

  2. #2
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    You mean binding the data to your DataGrid? Windows Forms or web app? I've got some example in both if it will help.

  3. #3

    Thread Starter
    PowerPoster
    Join Date
    Aug 2003
    Location
    Edinburgh, UK
    Posts
    2,773
    databind i think think i got it done but would like your example for a windows app

  4. #4
    Frenzied Member Mike Hildner's Avatar
    Join Date
    Jul 2002
    Location
    Des Moines, NM
    Posts
    1,690
    Code:
    private void RefreshData(string tableName)
    {
    		dsThisTable = DataBase.GetTable(tableName);
    		dgSelectedTable.CaptionText = tableName;
    		dgSelectedTable.SetDataBinding(dsThisTable, tableName);
    }
    dsThisTable is a DataSet. dgSelectedTable is my DataGrid. DataBase.GetTable returns a DataSet (yeah, probably didn't name things quite right).

    This is part of a generic form that gets all the user tables and views from a SQL Server DB, and populates a TreeView with their names. Then, when you click on a table/view, the DataGrid gets bound to that table/view. Quick little way to view/update any DB I point it to.

    Mike

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width