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!
Start Free Trial