compare string values in a recordset

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

Hello everone, I am a newbie and I have a recordset that returns the values

XXXXMain
XXXX1
XXXX2
XXXX3
XXXX4
XXXX5
XXXX6
YYYY1
YYYY2
YYYY3
YYYY4
YYYY5
YYYY6
ZZZZMain
ZZZZ1
ZZZZ2
ZZZZ3
ZZZZ4

but I would like the show the results in a tabular format according to the
first 4 charactes such as XXXX, then YYYY, and finally ZZZZ.

XXXXMain YYYYMain ZZZZMain
XXXX1 YYYY1 ZZZZ1
XXXX2 YYYY2 ZZZZ2
XXXX3 YYYY3 ZZZZ3
XXXX4 YYYY4 ZZZZ4
XXXX5 YYYY5
XXXX6 YYYY6

The select statement is sorting the result set. This result set is
populating a Datatable so I was thinking about somehow while looping through
the result set comparing the first 4 string values and creating a new cell
everytime the string values changes.

Hopefully I explained my intentions clearly.
Thanks In Advance
kw
Thanks in Advance for your assistance.
 
You can use while loop and if to compare the 1st character. VB.NET should
use Dataset than Recordset.

chanmm
 
Thanks chanmm! Some syntax would be helpful also. I will look into the while
loop in the meantime. I am using C# and using DataSet sorry for the incorrect
usage. But an example would be very helpful!

kw
 

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

Back
Top