View previous topic :: View next topic |
Author |
Message |
manni
Joined: 16 Jan 2006 Posts: 25
|
Posted: Tue May 09, 2006 8:06 am Post subject: Example with bind |
|
|
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 |
|
|
jpelcis
Joined: 09 Mar 2006 Posts: 40
|
Posted: Tue May 09, 2006 2:15 pm Post subject: |
|
|
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 |
|
|
manni
Joined: 16 Jan 2006 Posts: 25
|
Posted: Wed May 10, 2006 1:06 am Post subject: |
|
|
It run fine.
Thank you.
Manfred |
|
Back to top |
|
|
|