FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

Example with bind

 
Post new topic   Reply to topic     Forum Index -> DDBI
View previous topic :: View next topic  
Author Message
manni



Joined: 16 Jan 2006
Posts: 25

PostPosted: Tue May 09, 2006 8:06 am    Post subject: Example with bind Reply with quote

Hallo,

have someone an example with bind variables like this:

Statement stmt = new Statement(db, "SELECT ms FROM tables WHERE foo = ?");
stmt.bind(1, "12345");
stmt.query(); ??
stmt.execute();

I didn't know how to fetch the results.

Manfred
Back to top
View user's profile Send private message
jpelcis



Joined: 09 Mar 2006
Posts: 40

PostPosted: Tue May 09, 2006 2:15 pm    Post subject: Reply with quote

Try using stmt.query() instead of stmt.execute() at the end of what you have. When you use the query function, you get back the results.

Replace the last line of your code with the following:

Result results = stmt.query();
Row oneRow results.fetchRow();
// or
Row[] allRows results.fetchAll();

At this point, it's probably best to look at the documentation, since there are several different ways to get information from the rows. If you need more help though, go ahead and ask.


Last edited by jpelcis on Fri Jul 14, 2006 8:15 pm; edited 1 time in total
Back to top
View user's profile Send private message
manni



Joined: 16 Jan 2006
Posts: 25

PostPosted: Wed May 10, 2006 1:06 am    Post subject: Reply with quote

It run fine.
Thank you. Laughing

Manfred
Back to top
View user's profile Send private message
Display posts from previous:   
Post new topic   Reply to topic     Forum Index -> DDBI All times are GMT - 6 Hours
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2005 phpBB Group