Pulling all data from SQLite table column using C# iteration -
i've written sql query using stringbuilder , send off database using sqltedatareader
seen below:
string criteria = string.format("select tile_id {0} zoom_level = 14", dbtable); sqlitecommand command = new sqlitecommand(criteria, dbconn); sqlitedatareader reader = command.executereader(); while (reader.read()) { console.writeline("starting reader: \n"); foreach (var in reader) { console.writeline(i); } } ismet = true; } catch (exception e ) { console.write(e.stacktrace); }
dbtable
== map
. i've ran above sql query through sqlite browser , it's pulled correct information.
the returned value system.data.common.datarecordinternal
, after googling around i'm still little lost. lot of solutions i've found implement datareader
solves issue i'm using one.
tile_id
stored text
in sqlite, , far i've tried retrieve formatted string
, var
, int
, of have returned above value.
can offer advice?
you don't need foreach
loop. should change reader reading code be
console.writeline("starting reader: \n"); while (reader.read()) { console.writeline(reader["tile_id"].tostring()); }
see retrieving data using datareader. more information.
Comments
Post a Comment