none
Parameterized TableAdapter / Datagrid RRS feed

  • Question

  • Hill all, Newbie would appreciate a little help constructing first database (VB.net, Visual Studio 2008, SQL Server Compact 3.5)...

    Ok, got a form, have contructed my datasource and set up Table Adapters for the tables in the DataSet Designer. I now want to add a DataGrid to my form, BUT use a parametized query in the associated TableAdapter so that I can - via code - select only a subset of the table records to display in the Datagrid. Help explains how to add a WHERE clause to a TableAdapter query, so I think I can do that.

    My question are:
    1. Am I right in thinking I'll need to add the table adapter control (for the Table in question) onto my form, then also add a Data Binding Source, that will bind the DataGrid control to the Table Adapter? So the whole chain between the form and the database is Datagrid > DataBindingSource > TableAdapter > Physical database ?

    2. I also want to be able to Add and Delete records via the Datagrid. If the datagrid has only displayed a subset of records from the underlying Table, WHERE column X = value Y, then if I add a new record via the data grid, will that record automatically have it's column X value set to Y ?

    Appreciate any help ! ...  just need a little bit of coaching on the basics ...

    Monday, January 11, 2010 1:48 PM