473,386 Members | 1,786 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

VB6 Sort HELP

Hello:

I am very new to VB6, trying to do a datagrid sort with some VB code on a mySql database that is on my web site via ODBC.

The DataGrid is connected and working I can see all the fields on the database.

When I run the code listed below, it just sits there, nothing moves.

I am quite sure I am doing something wrong, but don't have a clue as to what it is.

Any help sure would be appreciated.

Tks.
Bill
-------------------------------------------------------------------------------------
Private Sub cmdTestSort2_Click()
Dim strQuery As String
strQuery = "SELECT * FROM proofrequest ORDER BY myCallback ='Y'"
Adodc1.RecordSource = strQuery
DataGrid1.Refresh
End Sub
Jul 30 '06 #1
5 7639
after refreshing the grid, have u re-fill the grid? if no, the call the Fucntion or Sub Routine to fill the grid.

Mahesh
Jul 31 '06 #2
Mahesh:

Thanks for the quick reply.
Not really sure how to do that, could you show me how to do it, in my code.

I sure would appreciate it, thanks again.

Bill
Jul 31 '06 #3
Private Sub cmdTestSort2_Click()
Dim strQuery As String
strQuery = "SELECT * FROM proofrequest ORDER BY myCallback ='Y'"
Adodc1.RecordSource = strQuery
DataGrid1.Refresh
' --- Call the function or sub routine here, which u used to fill the grid
Call FillGrid
End Sub

or let me know, how u fill the grid?

Mahesh
Jul 31 '06 #4
Mahesh:

The sort code listed below works BUT it uses a "Recordset.Filter "
I do Not want to use the filter method.

The refresh fills the grid through the adodc as far as I know. It should work the same as the first sort code I posted but something is missing :(

Thanks again
Bill

Private Sub cmdSortbyCallBack_Click()
Dim strQuery As String
strQuery = "SELECT * FROM proofrequest ORDER BY myCallBack DESC"
Adodc1.Recordset.Filter = "myCallback='Y'"
Adodc1.RecordSource = strQuery
DataGrid1.Refresh
End Sub
Aug 1 '06 #5
fplesco
82
Hello bdannels -

My observation to your problem is this:

strQuery = "SELECT * FROM proofrequest ORDER BY myCallback ='Y'"

is good

and can also be written
strQuery = "SELECT * FROM proofrequest ORDER BY myCallback ='Y' ASC"

Notice the ASC keyword which is the default for all ORDER BY clause. Since you had not specify the order (DESC or ASC), it has been defaulted to ASC.

It seems to me that, when you have initially filled your datagrid object with data from the database, same query had been executed. And that explains why you seemed to look at the data exactly the same as you previously loaded, nothing changes as you look at it.

My recommendation is, try this code

strQuery = "SELECT * FROM proofrequest ORDER BY myCallback ='Y' DESC"

and omit the Adodc1.Recordset.Filter = "myCallback='Y'"
...

As to your original code, just add a keyword DESC to your query, nothing else changes.
Jul 20 '07 #6

Sign in to post your reply or Sign up for a free account.

Similar topics

4
by: Seeker | last post by:
Hi, I have an array of objects. My object definition is given below: function tempArray(code,height,weight) { this.code = code; this.height = height; this.weight = weight; }
6
by: raj | last post by:
When I try to sort my combo box I get the following error. "Cannot sort a ComboBox that has a DataSource set. Sort the data using the underlying data model." ...
2
by: Joel | last post by:
I am having some problems compiling my code on Mandrake 10 with g++ (GCC 3.3.2). The problem seems to be in that I try to define a functor that compares two pointer objects, and use that functor to...
4
by: Nhmiller | last post by:
This is directly from Access' Help: "About designing a query When you open a query in Design view, or open a form, report, or datasheet and show the Advanced Filter/Sort window (Advanced...
7
by: ritchie | last post by:
Hi all, I am new to this group and I have question that you may be able to help me with. I am trying to learn C but am currently stuck on this. First of all, I have a function for each sort...
34
by: Mark Kamoski | last post by:
Hi-- Please help. I need a code sample for bubble sort. Thank you. --Mark
3
by: Alexander Widera | last post by:
Hi, I have a problem with this code ... (see below) ... I want to sort an instance of MyList ... by MyData.Shortname ... Shortname is of the type string.... how can I sort the entries? Thank...
48
by: Alex Chudnovsky | last post by:
I have come across with what appears to be a significant performance bug in ..NET 2.0 ArrayList.Sort method when compared with Array.Sort on the same data. Same data on the same CPU gets sorted a...
0
by: Amar | last post by:
Hi, I have a generic list with a some objects of a particular class in it. I have implemented a IComparer for the the class and pass it to the List. The list.sort method works fine when the value...
5
by: neocortex | last post by:
Hello! I am a newbie in Python. Recently, I get stuck with the problem of sorting by two criteria. In brief, I have a two-dimensional list (for a table or a matrix). Now, I need to sort by two...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.