1

I am using the SQLite ORM from Monotouch (https://github.com/praeclarum/sqlite-net)

I am trying to send in multiple parameters, but the parameter that is a string is not being added:

var items = db.Query<NameListItem>
        (Select * from table where field=? and field2=?,"SomeString",123);

When I enable trace it correctly displays the query:

Select * from table where field=? and field2=?
0: SomeString
1: 123
Ian Vink
  • 66,960
  • 104
  • 341
  • 555
  • What's your reason for thinking the string parameter is not added? Your trace proves it is added. – Jacco Jan 27 '13 at 19:02
  • It doesn't return a result set. When I take the query and drop it in a DB tool it returns. When I convert the query to a String.format model, it works – Ian Vink Jan 27 '13 at 19:03
  • That's clear then. The only thing I can think of, is some sort of type mismatch, but your example seems to staightforward. Especially since the string type should be the default: http://stackoverflow.com/questions/13347531/strange-behaviour-of-parameterized-sqlite-query – Jacco Jan 27 '13 at 19:24

1 Answers1

0

Are you sure the table name is really "table"? With SQLite-net, the name of the table is often going to be the name of the data structure that you are storing.

For example, your query should probably look like this:

var items = db.Query<NameListItem> ("select * from NameListItem where field = ? and field2 = ?", "SomeString", 123);
jstedfast
  • 35,744
  • 5
  • 97
  • 110