Visual Studio 2008 connecting to Oracle database

I have this attached code (ASP.net C# code) that I use to connect to a Oracle database to get some table's total record count. When I run in debug it shows that the value of "count" variable below is 1.
It should have been 215.

How do I troubleshot to see if it is really connecting to the db or not?

Also attached the partial content of the DL.cs file:
 
namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DL bDL = new DL();
            string sqlBranch = "select count(*) from mytab1";
            DataSet dsBranch = bDL.getDatasetFromJira(sqlBranch);
            string count;
            //count = dsBranch.Tables[0].Rows.Count();
            if (dsBranch.Tables[0].Rows.Count > 0)
            {
                count = dsBranch.Tables[0].Rows.Count.ToString();
            }

        }
    }
}

Open in new window

public DataSet getDatasetFromJira(string sql)
        {
            DataSet ds = new DataSet();
            OracleConnection sconn = new OracleConnection();
            sconn.ConnectionString = this.DSN_JIRA;
            sconn.Open();

            OracleCommand scmd = new OracleCommand();
            scmd.Connection = sconn;
            scmd.CommandText = sql;
            scmd.CommandType = CommandType.Text;


            OracleDataAdapter sda = new OracleDataAdapter();
            sda.SelectCommand = scmd;
            try
            {
                sda.Fill(ds);
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex.Message);

            }
            finally
            {
                if (sconn != null)
                    sconn.Dispose();

                if (scmd != null)
                    scmd.Dispose();

                if (sda != null)
                    sda.Dispose();
            }
            return ds;
        }

Open in new window

public string DSN_JIRA
        {
            get
            {
                return ConfigurationSettings.AppSettings["JIRADMConnectString"].ToString();
            }
        }

In web.config:
	<appSettings>
		<add key="JIRADMConnectString" value="Data Source=JIRA-DM-TESTDB;Persist Security Info=True;User ID=myact;Password=mypwd;"/>

Open in new window

toookiAsked:
Who is Participating?

[Product update] Infrastructure Analysis Tool is now available with Business Accounts.Learn More

x
I wear a lot of hats...

"The solutions and answers provided on Experts Exchange have been extremely helpful to me over the last few years. I wear a lot of hats - Developer, Database Administrator, Help Desk, etc., so I know a lot of things but not a lot about one thing. Experts Exchange gives me answers from people who do know a lot about one thing, in a easy to use platform." -Todd S.

käµfm³d 👽Commented:
You query does a COUNT(*), which is a scalar value and hence only 1 record. You are not selecting multiple rows (nor should you) when you do a COUNT query. I can't say I would have used the approach you have here, but to inspect the value of the COUNT, do this:
namespace WebApplication1
{
    public partial class Default : System.Web.UI.Page
    {
        protected void Page_Load(object sender, EventArgs e)
        {
            DL bDL = new DL();
            string sqlBranch = "select count(*) from mytab1";
            DataSet dsBranch = bDL.getDatasetFromJira(sqlBranch);
            string count;

            if (dsBranch.Tables[0].Rows.Count > 0)
            {
                count = dsBranch.Tables[0].Rows[0][0].ToString();
            }

        }
    }
}

Open in new window

käµfm³d 👽Commented:
You are not selecting multiple rows (nor should you) when you do a COUNT query.
To expand on this, I should say that when you do a COUNT query, you are asking the DB to return you one single value:  the number of records that satisfy the WHERE clause of the query, or the total number of records in the table if there is no WHERE clause.

For instance, if I had 3 records in my table:

ID  FNAME   LNAME
1   John    Doe
2   Jane    Doe
3   Jimmy   Smiles

Open in new window


and I did a COUNT query on this talbe as:

SELECT COUNT(1) FROM myTable

Open in new window


The result I would get back would be:

3

Open in new window

toookiAuthor Commented:
Thanks a lot for reply and explanation.
I wanted the count(*) in the query only to see if the program is really connecting to the database.
Actually I will need the dataset to have the content of the entire table.
When I use the query:
string sqlBranch = "select * from mytab1";
And run in debug mode I expected to see the "count" under the right click menu to show the number 215.
Otherwise in debug mode how do I check if the dataset is empty or got some returned values?
I attached the screnshot when debugging.
 scrren
C++ 11 Fundamentals

This course will introduce you to C++ 11 and teach you about syntax fundamentals.

käµfm³d 👽Commented:
It's a bit cumbersome to do, but in the Intellisense popup for dsBranch, expand Tables->Non-Public members->List->Rows->Count and you should see the number of records.
Via Intellisense
Alternatively, you can use the Immediate window ( Ctrl + Alt + i ) and enter the following command (including the question mark):

?dsBranch.Tables[0].Rows.Count

Open in new window


and you should get something like this:
 Via Immediate Window

Experts Exchange Solution brought to you by

Your issues matter to us.

Facing a tech roadblock? Get the help and guidance you need from experienced professionals who care. Ask your question anytime, anywhere, with no hassle.

Start your 7-day free trial
toookiAuthor Commented:
Many thanks.
I did not see Tables->Non-Public members->List->Rows->Count
Under Tables->Non-Public members-> There is no "List".
However, Immediate window ( Ctrl + Alt + i ) worked. And it let me get what I wanted.
Thanks.
käµfm³d 👽Commented:
There is no "List".
Interesting. My screenshot was from VS 2008. Admittedly, I did botch the list of elements to expand:  I forgot to include the first table inside of List (but you can see such in the screenshot).

In any event, glad you got what you needed  = )
It's more than this solution.Get answers and train to solve all your tech problems - anytime, anywhere.Try it for free Edge Out The Competitionfor your dream job with proven skills and certifications.Get started today Stand Outas the employee with proven skills.Start learning today for free Move Your Career Forwardwith certification training in the latest technologies.Start your trial today
.NET Programming

From novice to tech pro — start learning today.