Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people, just like you, are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
Solved

An explenation of a methode needed.

Posted on 2011-03-16
3
282 Views
Last Modified: 2013-12-17
Hi,

I have a question about this methode:

        public static DataSet GetHierarchy(string connectionString, int modelID)
        {
            string sql = "";
            DataSet ds = null;
            try
            {
                sql = "select * from hierarchy ";
                sql += "  where modelid=" + modelID.ToString();
                sql += "  order by parentnodeid,sortorder asc";
                ds = GetDataSet(connectionString, sql);
                SetHierarchyRelationships(ds);
            }
            catch (Exception) { throw; }
            return ds;
        }

1. Does anyone know what the sql-statement means?
2. What does this mean giving it the value null: DataSet ds = null;
3. What does += mean?

Peter
   
0
Comment
Question by:peterkiers
3 Comments
 
LVL 8

Accepted Solution

by:
crysallus earned 250 total points
ID: 35146735
1. select all columns in the table hierarchy where the modelid column has the value in the modelID variable, and order the results in ascending order by the value in the parentnodeid column

2. It just initialises the ds to null so it doesn't refer to any instance of DataSet.

3. += for strings concatenates strings together, so each time, the string is being added to what sql already contains.
0
 
LVL 10

Assisted Solution

by:Mathiyazhagan
Mathiyazhagan earned 250 total points
ID: 35146743
3. What does += mean?
   It is short-hand assignment operator. that, a value is added to left-handed variable and stored again in Left-handed variable.for example ,
  int  a =10;
  a+=5; //is equal to a= a+5, so a will 15
 
2.What does this mean giving it the value null: DataSet ds = null;
   yes, Dataset object is created with in try block. so , chances are there that it won't assigned with value
   if any error occurs before assigning value to it (ie, before   ds = GetDataSet(connectionString, sql)). but, we   need a defined value of ds before we are returning.so, it is initialized with Null value.

1. Does anyone know what the sql-statement means?
      I could not get your question.if you asking about variable "sql" means, it is string variable to
   store some string .
 
hope this helps.

0
 
LVL 1

Author Comment

by:peterkiers
ID: 35146789
Thanks.
0

Featured Post

How Do You Stack Up Against Your Peers?

With today’s modern enterprise so dependent on digital infrastructures, the impact of major incidents has increased dramatically. Grab the report now to gain insight into how your organization ranks against your peers and learn best-in-class strategies to resolve incidents.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

For those of you who don't follow the news, or just happen to live under rocks, Microsoft Research released a beta SDK (http://www.microsoft.com/en-us/download/details.aspx?id=27876) for the Xbox 360 Kinect. If you don't know what a Kinect is (http:…
This article aims to explain the working of CircularLogArchiver. This tool was designed to solve the buildup of log file in cases where systems do not support circular logging or where circular logging is not enabled
This video shows how to quickly and easily add an email signature for all users on Exchange 2016. The resulting signature is applied on a server level by Exchange Online. The email signature template has been downloaded from: www.mail-signatures…
With Secure Portal Encryption, the recipient is sent a link to their email address directing them to the email laundry delivery page. From there, the recipient will be required to enter a user name and password to enter the page. Once the recipient …

809 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question