Help on DataTable.Reset() and DataGrid

S

Simone

After a call to the Reset() method of a DataTable and
a call to the method Datasource of the datagrid for display data of the
DataTable i cannot see
the rows on the Grid.

Help me please.

By Simon.
 
A

Alex Feinman [MVP]

DataTable.Reset deletes tables schema (clears Columns collection) as well as
data. You are probably looking for DataTable.Clear()
Note that you are still not going to see any grid rows, but I assume this
was a typo and you meant to say that you don't see grid columns
 
S

Simone

DataTable.Reset deletes tables schema (clears Columns collection) as well
as
data. You are probably looking for DataTable.Clear()
Note that you are still not going to see any grid rows, but I assume this
was a typo and you meant to say that you don't see grid columns

I SEE THE Datagrid columns but i DON'T see the rows.

This is my code:

After the Reset i make this:
global.gv_SQLDOC_T_cmndDB.CommandText="SELECT * FROM " +
global.gv_nome_table + " WHERE COD_CAUS_DOC='" + global.gv_cod_caus_doc + "'
ORDER BY DATA_DOC";

global.gv_SQLDOC_T_dtDB.TableName=global.gv_nome_table;

global.gv_SQLDOC_dadaDB.SelectCommand=global.gv_SQLDOC_T_cmndDB;

global.gv_SQLDOC_dadaDB.FillSchema(global.gv_SQLDOC_T_dtDB,SchemaType.Source
);

global.gv_SQLDOC_dadaDB.Fill(global.gv_SQLDOC_T_dtDB);

After this i don't see the rows on the datagrid.
 
S

Simone

Pardon.

I call The DataTable.Reset()
I refill the DataTable with the DataAdapter.
I set the DataSource property of the datagrid to the Datatable but i cannot
see the rows in the datagrid.

PS: The DataTable after the refill is not empty.
 
P

Peter Foot [MVP]

Try setting the DataSource property of the grid to null (or Nothing in VB)
and then back to your refilled DataTable, does that cause it to update
correctly?

Peter
 
S

Simone

Try setting the DataSource property of the grid to null (or Nothing in VB)
and then back to your refilled DataTable, does that cause it to update
correctly?

Peter

I try but wothout success.... this is a BUG?

Simon.
 
I

Ilya Tumanov [MS]

It sure is. Now we have to determine is it's a CF bug or is it a bug in your
code.

If you can post a small, but complete and compliable repro, I would
investigate this issue to figure it out.



Few tips on creating a good repro:

- Use NorthWind database which comes with VS for a repro so you won't have
to share your data base.

- Do not use helper classes you might have, copy relevant code instead.

- Do not use 3rd party DLLs.

- Keep it all in one file.

- Keep code size to a minimum.



In this case, please create a new project, drag a data grid, a button and do
whatever you're doing in your real project in the button click event.



Best regards,



Ilya



This posting is provided "AS IS" with no warranties, and confers no rights.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top