本文介绍了选择查询和数据集中出现意外结果.的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好,Legend,
今天,我观察到选择查询和数据集的一些尴尬行为.通过简单的查询,我就可以从一个字段中获取所有值并将其显示在数据集中.但是,在填充数据集时,它与实际数据库表中的值并不相同.
例如,表名是 Testable :字段是 Field1(varchar),该字段中的值是:

Field1
000-00010-00
000-00020-00
000-00030-00
………….etc

当我从C#编写查询时,如下所示:
Command.Text =从Testable中选择Field1"
并在使用数据适配器将其填充到DataSet obect中之前,在填充数据集之前,我也要重置数据集.
但是价值观的到来是错误的:
它的出现是这样的:
000-0001-00
000-0002-00
000-0003-00
……..

我已经调试了我的代码,所有内容都是正确的,它指向正确的数据库,正确的表,正确的查询但错误的值.这怎么可能?我没有任何想法…或没有线索.有人可以帮我解决这个错误的可能原因吗????

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:

Field1
000-00010-00
000-00020-00
000-00030-00
………….etc

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:
000-0001-00
000-0002-00
000-0003-00
…….etc.

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?????

推荐答案



这篇关于选择查询和数据集中出现意外结果.的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持!

05-28 02:03
查看更多