File APIs for Java Developers
Manipulate DOC, XLS, PPT, PDF and many others from your application.
http://aspose.com/file-tools
The moose likes Android and the fly likes connecting to sqlite database Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Mobile » Android
Bookmark "connecting to sqlite database" Watch "connecting to sqlite database" New topic
Author

connecting to sqlite database

vinal s.sen
Greenhorn

Joined: Jul 20, 2012
Posts: 9
hi all!!!


i am doing a project,for which I am trying to select only certain rows,using the condition where.

how to write sql statement and retrieve certain rows only.



output is not right...... what is the method I should be using to select only certain rows.

thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
What is the output you are getting now, and which output would you like to get?
vinal s.sen
Greenhorn

Joined: Jul 20, 2012
Posts: 9
Sorry for me being vague. i try to input value to a textbox and based on that ,i want to get rows from the table..please help me..i am finding it difficult to use variable in a select statement...



cursor does not return any values...no output produced on the screen.how do I use a variable???

(however if i supply the value directly,it is working and fine and comes up with data)

thanks in advance
Ulf Dittmer
Marshal

Joined: Mar 22, 2005
Posts: 42919
    
  68
You're passing the literal value "nn" to the query, instead of the value of the variable "nn". Instead of this:



try something like this:



That's what the javadocs of that method mean when they talk about using "?". It's similar to using a PreparedStatement in JDBC. Since you're using "like", the value of "nn" should most likely have % characters at the beginning and end, as in

vinal s.sen
Greenhorn

Joined: Jul 20, 2012
Posts: 9
thanks a lot,Ulf Dittmer....I have been struck with this 6 to 7 hours..was not able to solve it.

now it works

I went through net..could not find a solution.Is there any book that you will recommend?

once again,thanks
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: connecting to sqlite database