Winforms Datagrid Not being populated with correct values..

H

Hanover

Here is a very strange problem that is difficult to explain.

I am populating a datagrid with a datatable. I had to add an
additional field to my data adapter/datatable which I have to reference
during my update.

The field should have values such as:

767
790
801
834....

Instead, its showing this:

0
1
2
3
4...all the way to the number of rows I have.

It's like it's showing the row index rather than the correct data.

I've checked my SQL Data Adapter and the ID is showing up correctly in
the preview. I've put the SQL Statement into SQL Query Analyzer and
its working fine there too.

It seems to be getting changed when it hits the dataset.

I've been trying to figure this out for three hours now and it makes
absolutely no sense.

Has this ever happened to anyone else?
 
H

Hanover

I figured out what is going on. Since that column is an incrementing
ID field, it's setting the datatable field to auto-increment. When
turned that off and allowed nulls, for some strange reason the IDs are
not populating into the datatable when I do the fill. So it naturally
starts at zero and works its way up.

This absolutely makes no sense at all. Why wouldnt it populate my
datatable with these values?

Im about to tear my hair out!
 

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