|
-
April 27th, 2008, 06:41 PM
#1
ORDER BY in Netbeans...
Hey all, I've got a question. How would one ORDER BY *insert column name* in Netbeans? I know how to use it in the "execute command" part for the database itself...
SELECT HOLIDAY, CUSTOMER, DATE FROM WAITLIST ORDER BY DATE
Which then orders it by date, but I want to have a function (in one of my classes) execute that command so it reorganizes the database table from that class, but I'm not sure how to set up the function... I thought something like a simple void function and:
orderWait.executeQuery();
would work, but obviously not. Any help would be appreciated.
Also, I am using prepared statements to access the database, so that's not the problem either.
Last edited by Blind Melon; April 27th, 2008 at 08:00 PM.
I need a map of your head,
Trans-lated into English,
So I can learn to not make you frown.
-
April 28th, 2008, 04:28 AM
#2
Re: ORDER BY in Netbeans...
 Originally Posted by Blind Melon
... I want to have a function (in one of my classes) execute that command so it reorganizes the database table from that class
Can you explain what you mean a little more clearly - perhaps a couple of examples might help...
If you want to make the column name in the 'ORDER BY' clause a variable, you just tack a String variable into your SQL expression:
Code:
String sqlExpression = "... ORDER BY " + columnName;
A prudent question is one-half of wisdom...
F. Bacon
Please use [CODE]...your code here...[/CODE] tags when posting code. If you get an error, please post the full error message and stack trace, if present.
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|