• Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

connecting to sqlite database

 
vinal s.sen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What is the output you are getting now, and which output would you like to get?
 
vinal s.sen
Greenhorn
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Rancher
Posts: 42969
73
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
Posts: 9
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic