Click here to Skip to main content
15,308,835 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
Hi all Legend,
Today I observed some awkward behaviour of select query and dataset. With just simple query I am getting all the values from one field and displaying that in dataset. But while filling in dataset it is not the same values which are there in actual database table.
For example Table name is Testable: Field is Field1(varchar), values there in this fields are:


while I am writing the query from C# like below:
Command.Text=”select Field1 from Testable”
And filling this in DataSet obect with dataadapter,before filling the dataset I am resetting the dataset too.
But values comings are wrong:
Its coming like:

I have debugged my code, everything is correct, its pointing to correct database, correct table, correct query but wrong values. how come is this possible?? I am not getting any idea…or not getting clues. could somebody pls help me out what could be the possible reason for this bug?????
Wonde Tadesse 9-May-11 19:46pm
Can you post the code for filling the dataset ?

have you given any format in the datatable? how have you created the table? have you seen the table while debugging in table viewer?
Have you set the maximum limit to the Field1 in the TestTable? Because it seems that one character is cut and also I was wondering if you have put any kind of format in your Field1?

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900