Advertisement

07.12.2008 at 12:20PM PDT, ID: 23559918
[x]
Attachment Details

ORDER BY not working

Asked by rmmarsh in Interbase / Firebird Database

I have a C# program where I use the following statement to order the return values... it's not working... the results are in a random order.  When I reorder them using SQL Maestro (click on BookNbr column) the reorder properly.  
.
Why?
Start Free Trial
1:
2:
3:
4:
5:
6:
7:
8:
9:
10:
11:
12:
13:
14:
15:
16:
cmd = new FbCommand("SELECT ISBN, BookNbr, Condn FROM tBooks WHERE Stat = 'For Sale'AND ISBN != '' AND DoNotReprice != 'T'  ORDER BY 'BookNbr' ASC", bookConn);
 
            try
            {
                if (bookConn.State == ConnectionState.Closed)
                    bookConn.Open();
 
                dr = cmd.ExecuteReader();
                int j = 0;
                while (dr.Read())  //  place all ISBNs in the array, starting pos -> 1 (0 is count)
                {
                    listISBNs[j].ISBN = dr.GetString(0);  //  ISBN
                    listISBNs[j].SKU = dr.GetString(1);  //  get SKU while we're here
                    listISBNs[j++].bookType = dr.GetString(2).ToString().ToLower().Contains("new") ? 'n' : 'u'; //  if condition is 'new'
                }
            }
[+][-]07.12.2008 at 01:51PM PDT, ID: 21990348

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.12.2008 at 02:50PM PDT, ID: 21990471

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zone: Interbase / Firebird Database
Sign Up Now!
Solution Provided By: angelIII
Participating Experts: 2
Solution Grade: A
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_EXPERT_20070906