Hello
Thanks for ypur help. I achieved what i wanted. I found out that didn't have to bind the result. I just userd result = sqlite3_column_int to get my result. I also had to drop the quotes to make it work properly. Thanks a lot :-) -------- Original-Nachricht -------- > Datum: Wed, 12 Mar 2008 08:27:47 -0400 > Von: "Igor Tandetnik" <[EMAIL PROTECTED]> > An: sqlite-users@sqlite.org > Betreff: Re: [sqlite] [C] Problem getting int results > ""Severin Müller"" <[EMAIL PROTECTED]> wrote > in message news:[EMAIL PROTECTED] > >> ""Severin Müller"" <[EMAIL PROTECTED]> > >> wrote in message > >> news:[EMAIL PROTECTED] > >>> int func(void) > >>> { > >>> // database is open and the select statement is executed > >>> // this is the query: char *sql = "SELECT 'protect' FROM > >>> 'test_db');"; > >> > >> You should get an error here. If you don't, the statement you > >> actually run differs from the one you show. > > > > Neither. No Error, and it's axactly the statement i'm passing > > You sure? Complete with unmatched closing parenthesis? > > Yes, I see that SQLite manages to accept a string literal in the FROM > clause, and interpret it as a table name. This is not valid SQL, SQLite > seems to accept it as an extension. > > In any case, the statement likely doesn't do what you think it's doing. > It returns a resultset with the literal string 'protect' repeated for > each row in the table test_db. I guess you wanted to select a column > named protect: in this case, just drop the quotes: > > select protect from test_db; > > Or, if you insist, use double quotes (though they are unnecessary in > this case): > > select "protect" from "test_db"; > > >>> { > >>> if((rc=sqlite3_bind_int(oStmt,0,result))==SQLITE_OK) > >> > >> You don't have any parameter placeholders in your statement. What > >> exactly are you binding here? > > > > That's what i'm asking. I don't understand what todo with this call > > at all. > > That rather depends on what you are trying to achieve, which I believe > you've never explained. > > For description of SQL parameters, see > > http://sqlite.org/c3ref/bind_blob.html > > To retrieve individual fields from the resultset, use sqlite3_column_* > API: > > http://sqlite.org/c3ref/column_blob.html > > >> The variable 'result' is never modified in your code. What do you > >> expect to see in it, other than its initial value of zero? > > > > i thought the variable result was changed to it's value in the > > sqlite3_bind_in function. > > sqlite3_bind_int takes its 'int' parameter by value. It can't possibly > modify it. > > Again, sqlite3_bind_* is for setting statement parameters. To retrieve > values from resultset, use sqlite3_column_* > > Igor Tandetnik > > > -- Freundliche Grüsse // Kind regards IBM Global Technology Services Switzerland Severin A. Mueller Assistant eWP Teamleader Mythenquai 2 CH-8022 Zurich Office: +41 44 625 30 41 Mobile: +41 76 249 85 38 GMX startet ShortView.de. Hier findest Du Leute mit Deinen Interessen! Jetzt dabei sein: http://www.shortview.de/[EMAIL PROTECTED] _______________________________________________ sqlite-users mailing list sqlite-users@sqlite.org http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users