By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
435,501 Members | 2,797 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 435,501 IT Pros & Developers. It's quick & easy.

retrieve data from database with duplicate values

jamesd0142
100+
P: 469
I have the follwoing code that populates a txt box by reading values from a database table.

While Reader4.Read()
Category4 = Reader4.Item(Columns4)'READ COLUMN FROM DATABASE
txtAnswer.Text = Category4
End While

columns4 contains the id field within this table. there are duplicateds. so i hvae to records with the id filed '1'

when i run the code it retrieves the first record and then over writes with with the next value in the table with the same id.

Would any1 know how to edit this so that it only displays the first value it gets?

Thanks
Sep 19 '07 #1
Share this Question
Share on Google+
2 Replies


jamesd0142
100+
P: 469
Ignore this it works, stupid question SORRY
Sep 19 '07 #2

VBPhilly
P: 95
Ignore this it works, stupid question SORRY
Glad it worked.

Duplicates query (in case anyone wants to know)

Returns duplicate records:

SELECT DuplicatedField
FROM TableName
GROUP BY DuplicatedField
HAVING COUNT(DuplicatedField) > 1
Sep 19 '07 #3

Post your reply

Sign in to post your reply or Sign up for a free account.