displaying table count in label

  • Thread starter Thread starter zoom14151
  • Start date Start date
Z

zoom14151

I have a project that I need to display the incident count from a
table. I have the connection, command, adapter and dataset. The dataset
has one column "2005" The connection is to a Oracle database. I can
preview the data in the dataset but I can't figure out to display it in
a labels text.
 
You need to try to get the the value in the dataset.... lets say your
xommand returns one record set with only your value ( like an execute
scalar )
myLabel.Text = MyDS.Tables[0].rows[0]["2005"].ToString();

Let's say your command returns multiple recordsets and tables ( so that
you actually have a reason for needeing a dataset in the first place )
you would fetch it differnetlyu

myLabel.Text =
MyDS.Tables[RecordsetNumberContainintdata].rows[0]["2005"].ToString();

So if your command has
select * from whatever
select * from elsewhere
select val as 2005 from my table
then
RecordsetNumberContainintdata = 2
 
Back
Top