Solved

An explenation of a methode needed.

Posted on 2011-03-16
3
284 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
[X]
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
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

Stressed Out?

Watch some penguins on the livecam!

Question has a verified solution.

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

We all know that functional code is the leg that any good program stands on when it comes right down to it, however, if your program lacks a good user interface your product may not have the appeal needed to keep your customers happy. This issue can…
In my previous two articles we discussed Binary Serialization (http://www.experts-exchange.com/A_4362.html) and XML Serialization (http://www.experts-exchange.com/A_4425.html). In this article we will try to know more about SOAP (Simple Object Acces…
NetCrunch network monitor is a highly extensive platform for network monitoring and alert generation. In this video you'll see a live demo of NetCrunch with most notable features explained in a walk-through manner. You'll also get to know the philos…
Do you want to know how to make a graph with Microsoft Access? First, create a query with the data for the chart. Then make a blank form and add a chart control. This video also shows how to change what data is displayed on the graph as well as form…

726 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