怎么用C语言动态往sqlite3里面插入数据
1个回答
展开全部
首先说明这个问题困扰了我很长时间了,严格地说应该有两天,不过终于通过sqlite的官方文档解决了。
For example, assume the string variable zText contains text as follows:
char *zText = "It's a happy day!";
One can use this text in an SQL statement as follows:
char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText); sqlite3_exec(db, zSQL, 0, 0, 0); sqlite3_free(zSQL);
摘自liuzhidong123的专栏
For example, assume the string variable zText contains text as follows:
char *zText = "It's a happy day!";
One can use this text in an SQL statement as follows:
char *zSQL = sqlite3_mprintf("INSERT INTO table VALUES('%q')", zText); sqlite3_exec(db, zSQL, 0, 0, 0); sqlite3_free(zSQL);
摘自liuzhidong123的专栏
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |