Hi all,
I create a table like this "create table tbl1 (ID integer primary
key, name, addr)" ,
then insert a record:
"insert into tbl1 values(1, 'aa', 'bb')",
select the record:
"select * from tbl1 where name ='aa' " ,can get this record :
(1, 'aa', 'bb')
I change insert way like this:
char *pName = "aa";
sqlite3_prepare(db," insert into tbl1(1,?,'bb')",-1, &stat, 0);
sqlite3_bind_blob( stat, 1, pName, strlen(pName)+1, 0 );
sqlite3_step(stat);
Then select the record:
sqlite3_prepare(db, "select * from tbl1 where name ='aa' ", -1,
&stat, 0);
sqlite3_step(stat);
By this way, I can not get the record I want : (1, 'aa', 'bb').
Change the SQL statement by "like":
sqlite3_prepare(db, "select * from tbl1 where name like 'aa'
", -1, &stat, 0); sqlite3_step(stat);
I can get the record.
Why? and How can I select record by "=" condition to a string?
Thanks!
yoky
_______________________________________________
sqlite-users mailing list
[email protected]
http://sqlite.org:8080/cgi-bin/mailman/listinfo/sqlite-users