troubleshooting Question

Select specific field from dataset

Avatar of johndeerb
johndeerb asked on
.NET ProgrammingASP.NET
5 Comments1 Solution470 ViewsLast Modified:
I'm a rookie at asp.net, so I apologize if this question is stupid.

I have a page that needs information from a SQL DB, so I have been making multiple connections to the DB during page load and event handlers on the page.  As I'm adding functionality to the page, I want to stop making so many connections to the database.  I decided to connect to the DB in the page load event and fill a couple of datasets or datatables with the data that I need to display on the page and then pull what is needed from those datasets or datatables.  This is where I'm getting stumped.  I currently have one dataset and one datatable that are getting filled at page load.  I know this works because I can throw a gridview on the page and bind it to the dataset or datatable and it displays all the data that I queried from the DB.  Now the problem...

I need to be able to query specific data from the dataset like I would from SQL to display when certain events fire, but I haven't figured out how yet.  I read that I could use the datatable.select method to grab an entire row from a table, but I need to query for one field based on criteria.  Here is a partial layout of the datatable:

_date               _name          _dept
08/01/2008      John             I.T.
08/01/2008      Joel              Maintenance
08/01/2008      Bill                Biomed
08/02/2008      Brad             I.T.
08/02/2008      Wes             Maintenance
08/02/2008      Ken              Biomed

and so on... what I need is to be able to query something like
Select _name from mydatatable where date = '08/01/2008' AND _dept = 'Biomed'
so that I can display that name on a calendar or other form controls..

Again, I apologize for the newbie question.  Can anyone get me started in the right direction?
Thanks in advance for you help!
Join the community to see this answer!
Join our exclusive community to see this answer & millions of others.
Unlock 1 Answer and 5 Comments.
Join the Community
Learn from the best

Network and collaborate with thousands of CTOs, CISOs, and IT Pros rooting for you and your success.

Andrew Hancock - VMware vExpert
See if this solution works for you by signing up for a 7 day free trial.
Unlock 1 Answer and 5 Comments.
Try for 7 days

”The time we save is the biggest benefit of E-E to our team. What could take multiple guys 2 hours or more each to find is accessed in around 15 minutes on Experts Exchange.

-Mike Kapnisakis, Warner Bros