VS2005 Beta2 "Preview Data" Window Returns Query Results, but my code does not return results

I'm stumped...

I'm using the Beta2 of Visual Studio 2005

When I run a query in "Preview Data" by right clicking on the BindingSource or the dataTableAdapter i get results returned from the query, but when I use the following code in a dataGridView, my code (I'm using the same dataTableAdapter, dataSet, DataTable and FillBy method as in the "Preview Data" window) tells me that no records were returned.

dataGridView.DataSource = dataTableAdapter.FillBy(dataSet.DataTable);

Has anyone else had this happen   Any suggestions as to what I am doing wrong

Thanks for you help,

Paul




Answer this question

VS2005 Beta2 "Preview Data" Window Returns Query Results, but my code does not return results

  • Juice Johnson

    Michael:

    Your re-write worked fine.

    Thanks so much for taking the time to catch my mistake Big Smile

    Paul

  • AJMurray

    I'm not sure if I'm following you here, but a quick check tells me that you need to first fill your datatable, then set the datasource of the gridview to the datatable, like this:


    dataTableAdapter.FillBy(dataSet.DataTable);
    dataGridView.DataSource = dataSet.DataTable;

     


    Or you could use the TableAdapter.GetData() method to return a datatable to your datasource.

  • VS2005 Beta2 "Preview Data" Window Returns Query Results, but my code does not return results