当前位置:数据库 > SQLite >>

怎么用C语言动态往sqlite3里面插入数据

 

首先说明这个问题困扰了我很长时间了,严格地说应该有两天,不过终于通过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的专栏

补充:软件开发 , C语言 ,
Oracle
MySQL
Access
SQLServer
DB2
Excel
SQLite
SYBASE
Postgres
如果你遇到数据库难题:
请访问www.zzzyk.com 试试
CopyRight © 2012 站长网 编程知识问答 www.zzzyk.com All Rights Reserved
部份技术文章来自网络,