473,418 Members | 2,080 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,418 software developers and data experts.

can this be done

I'm creating a dataset and get my data from the db table such as PA, PA, WA,
WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that dataset and
populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx
Nov 19 '05 #1
6 1004
Hi,

The easiest way to do this is when you get the data from the DB. Do a
"Select Distinct" instead of a regular select. For example:

Select
State
From
Orders

This will give you the data you showed first...lots of repeats. So instead
do:

Select Distinct
State
From
Orders

Now you will get each state only once. One tip I will give you about data
and queries is never to forget about the
microsoft.public.sqlserver.programming group. SQL isn't my specialty and I
have learned a *TON* from those guys. Not to mention they totally saved my
butt once. Whenever I catch myself using excessive code to wrangle data I
received from a query I go there first to figure out how to make a better
query. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Mike" <me@me.com> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
I'm creating a dataset and get my data from the db table such as PA, PA, WA, WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that dataset and populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx

Nov 19 '05 #2
I'm calling a stored procedure and getting the data. I'm already using the
dataset to populate a datagrid and i was wondering if I could use that same
dataset to populate the combo box without making another trip to the
database
"Ken Dopierala Jr." <kd*********@wi.rr.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

The easiest way to do this is when you get the data from the DB. Do a
"Select Distinct" instead of a regular select. For example:

Select
State
From
Orders

This will give you the data you showed first...lots of repeats. So
instead
do:

Select Distinct
State
From
Orders

Now you will get each state only once. One tip I will give you about data
and queries is never to forget about the
microsoft.public.sqlserver.programming group. SQL isn't my specialty and
I
have learned a *TON* from those guys. Not to mention they totally saved
my
butt once. Whenever I catch myself using excessive code to wrangle data I
received from a query I go there first to figure out how to make a better
query. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Mike" <me@me.com> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
I'm creating a dataset and get my data from the db table such as PA, PA,

WA,
WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that dataset

and
populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx


Nov 19 '05 #3
Hi Mike,

I'm assuming you are using ADO.Net. I don't know a way to do what you want,
however someone may know and get right back to you on it. The neat thing
about ADO.Net is that you can do what you want with minimal effort and only
one call to the DB. ADO.Net returns all your Selects. Not just the last
one you performed. So give this a try modifying my pseudo code from before
to work for your needs. In the query you are running to fill that data grid
put this in a way it makes sense for you at the bottom of that query:

Select Distinct
State
From
Orders

Basically, that represents the 2nd query (i.e. 2nd trip to DB). Now check
out what you get back! Use the debugger and you'll see that not only is
your objDataSet.Tables(0) filled with data, but your objDataSet.Tables(1) is
also filled with the other query. Now you have both sets of data, one DB
trip, and at a very minimal cost in respect to your States lookup. I know
this isn't the same as running a query on the one dataset you have in your
hands but it may be a solution for you. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Mike" <me@me.com> wrote in message
news:%2****************@TK2MSFTNGP14.phx.gbl...
I'm calling a stored procedure and getting the data. I'm already using the
dataset to populate a datagrid and i was wondering if I could use that same dataset to populate the combo box without making another trip to the
database
"Ken Dopierala Jr." <kd*********@wi.rr.com> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
Hi,

The easiest way to do this is when you get the data from the DB. Do a
"Select Distinct" instead of a regular select. For example:

Select
State
From
Orders

This will give you the data you showed first...lots of repeats. So
instead
do:

Select Distinct
State
From
Orders

Now you will get each state only once. One tip I will give you about data and queries is never to forget about the
microsoft.public.sqlserver.programming group. SQL isn't my specialty and I
have learned a *TON* from those guys. Not to mention they totally saved
my
butt once. Whenever I catch myself using excessive code to wrangle data I received from a query I go there first to figure out how to make a better query. Good luck! Ken.

--
Ken Dopierala Jr.
For great ASP.Net web hosting try:
http://www.webhost4life.com/default.asp?refid=Spinlight
If you sign up under me and need help, email me.

"Mike" <me@me.com> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
I'm creating a dataset and get my data from the db table such as PA,
PA, WA,
WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that
dataset and
populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx



Nov 19 '05 #4
You need to create another table that will hold only distinct codes. You can
add it to the same dataset or have in a different dataset. After populating
the big table, loop through it, detect new codes, and add them to that new
table.

Eliyahu

"Mike" <me@me.com> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
I'm creating a dataset and get my data from the db table such as PA, PA, WA, WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that dataset and populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx

Nov 19 '05 #5
new table you mean datatable or an actualy table in the DB?
would you have a snippet on doing this?
"Eliyahu Goldin" wrote:
You need to create another table that will hold only distinct codes. You can
add it to the same dataset or have in a different dataset. After populating
the big table, loop through it, detect new codes, and add them to that new
table.

Eliyahu

"Mike" <me@me.com> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
I'm creating a dataset and get my data from the db table such as PA, PA,

WA,
WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that dataset

and
populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx


Nov 19 '05 #6
I mean a datatable in a dataset, not in the DB. I do have a piece of code
doing this, but it is specific to the class infrastructure I am using and it
would take some time to make it understandable for you. Sorry.

Eliyahu

"Mike" <Mi**@discussions.microsoft.com> wrote in message
news:2A**********************************@microsof t.com...
new table you mean datatable or an actualy table in the DB?
would you have a snippet on doing this?
"Eliyahu Goldin" wrote:
You need to create another table that will hold only distinct codes. You can add it to the same dataset or have in a different dataset. After populating the big table, loop through it, detect new codes, and add them to that new table.

Eliyahu

"Mike" <me@me.com> wrote in message
news:Oj**************@tk2msftngp13.phx.gbl...
I'm creating a dataset and get my data from the db table such as PA,
PA, WA,
WA CA, DE, DE, DE, FL, WI. is there a way to do a select on that
dataset and
populate a drop down box such as CT, DE, FL, WI?

i don't want to see multiple DE's or PA's, etc.
thx


Nov 19 '05 #7

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: itsharkopath | last post by:
Hi, Imagine a user in a hotspot, when he comes to the hotspot and tries to load a webpage (on the internet), he would automatically redirected to login page. I believe the following is to be...
9
by: Steven T. Hatton | last post by:
This was written for the gnu.g++.help list. It rather clearly spells out the most important feature of Java that I believe C++ lacks. I really don't believe the C++ Standard sepcifies enough for a...
16
by: jaialai technology | last post by:
I want to reload a url in a browser window so I do something like this: open(window.location.href= "www.yahoo.com"); ok, so now I want to do something when that page is done loading completely....
5
by: Morten Overgaard | last post by:
Hi I have a C# component which fires events. I want to catch these events in my MFC app compiled with the /clr. I know I can define a managed class in my MFC app which traps the events - but I...
11
by: Sharon | last post by:
I'm writing a new control derived from UserControl. I need to get an event when the control is done resizing. I tried the Resize, SizeChanged, Move and the Layout events and I also tried to...
3
by: Miguel Dias Moura | last post by:
Hi, When I subscribe a web site I usually receive an email to confirm my subscription. Only after I follow the link in the email my account gets activated. In general, how is this done? Can...
4
by: BrianDH | last post by:
Group Early this week I ask for examples on how to call a VB.NET Web Service and access its DataSet for a traditional ASP page. I was told, "you can't", "won't work", "not possible". Well I...
12
by: Ark | last post by:
Hello NG, I arrange data in structs like { members... uint16_t crc; more members, maybe... } Then I need to save them, up to and including crc, in non-volatile memory or a file, as the case...
2
by: maya | last post by:
http://news.yahoo.com/news?tmpl=index2&cid=703 down the page, under "More Stories", there's a section with two interchangeable divs which slide back and forth into view.. how is this done? I...
2
by: poolboi | last post by:
hey guys, i've done most of my web app. for searching almost done but then i got a small little problem with logging in i need to know how session tracking is done in perl if not my log in page...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.