aspose file tools*
The moose likes JDBC and the fly likes Reading multple columns in 1 query. Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Reading multple columns in 1 query." Watch "Reading multple columns in 1 query." New topic
Author

Reading multple columns in 1 query.

Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
I'm attaching to an Access 2000 database on a shared mapped drive and can pull 1 column in at a time through my SQL statement. I have to execute a separate SQL call for each column, which seems to be a waste. I want to be able to pull in and show all the fields in each row.
What do I do to show both / all of the columns in each row?


(I'm just trying to get a handle on this, so I know this application doesn't make sense yet....)
Thanks in Advance!
[ February 18, 2004: Message edited by: Sam Smoot ]

CNSS/NSA Infosec Professional,<br />Software Engineer
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

This could be your problem, unless SQL Server allows this!
String SQL="SELECT FirstName LastName FROM TeamInfo";
the missing comma between FirstName and LastName.
Try changing it to
String SQL="SELECT FirstName, LastName FROM TeamInfo";


The future is here. It's just not evenly distributed yet. - William Gibson
Consultant @ Xebia. Sonny Gill Tweets
Sam Smoot
Ranch Hand

Joined: Apr 18, 2002
Posts: 238
DUHHHHHHHH!!!
That fixed it...
I gotta quit running in mixed mode and stick to one thing...
Thanks!
Sonny Gill
Ranch Hand

Joined: Feb 02, 2002
Posts: 1211

no worries, mate.
cases like this, sometimes you can debug by trying to use PreparedStatement instead of Statement. cheers
Bear Bibeault
Author and ninkuma
Marshal

Joined: Jan 10, 2002
Posts: 61221
    
  66

And if you want all the columns you can just use SELECT * FROM ...


[Asking smart questions] [Bear's FrontMan] [About Bear] [Books by Bear]
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Reading multple columns in 1 query.