""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');";

This is not valid SQL. FROM clause expects a table name, not a string 
literal.

> struct sqlite3_stmt *oStmt;
> int rc;
> int result = 0;
>
> if((rc=sqlite3_prepare_v2(db,sql,strlen(sql),&oStmt,NULL))==SQLITE_OK)

You should get an error here. If you don't, the statement you actually 
run differs from the one you show.

> {
> 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?

> {
> if((rc=sqlite3_step(oStmt))==SQLITE_ROW)
> {
> printf("result: %i\n",result);

The variable 'result' is never modified in your code. What do you expect 
to see in it, other than its initial value of zero?

> But i always get the following error message:
>
> "Bind or column index out of range"
>
> What did i do wrong?

You try to bind a parameter that doesn't exist in the statement.

Igor Tandetnik



_______________________________________________
sqlite-users mailing list
sqlite-users@sqlite.org
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users

Reply via email to