Win a copy of The Java Performance Companion this week in the Performance forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

Reading multple columns in 1 query.

 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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 ]
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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";
 
Sam Smoot
Ranch Hand
Posts: 238
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
DUHHHHHHHH!!!
That fixed it...
I gotta quit running in mixed mode and stick to one thing...
Thanks!
 
Sonny Gill
Ranch Hand
Posts: 1211
IntelliJ IDE Mac
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Pie
Posts: 64970
86
IntelliJ IDE Java jQuery Mac Mac OS X
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
And if you want all the columns you can just use SELECT * FROM ...
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic