Simple DB process method in program

前端之家收集整理的这篇文章主要介绍了Simple DB process method in program前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

Used to process simple DB in Windows by using Python,C++ and C# before,the DB was Microsoft Access and sqlite.

1,Python to import DB to Microsoft Access,code as below,for illustration only,

conn = win32com.client.Dispatch("ADODB.Connection")
DSN="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + db
conn.Open(DSN)
insertfmt = "sql command here"
sql = insertfmt.format("prepare the data here")
conn.Execute(sql) //execute sql command

2,C# to create and insert sqlite db,
sqliteConnection.CreateFile(dbFileName);
conn = new sqliteConnection("Data Source=" + dbFileName);
conn.Open();
cmd.CommandText ="put your sql command here";
cmd.ExecuteNonQuery(); //execute command

3,C++sqliteEncrypt,
Cppsqlite3DB db;
db.open(gszFile); //gszFile is the db name and location
// supply password key after db file opened 
db.key("123456789",(int)strlen("123456789"));

// reset / change your password phrase on the fly
db.rekey("987654321",(int)strlen("987654321"));
Cppsqlite3Table t1 = db.getTable("SELECT * FROM APDU;");
//display the table content
for (fld = 0; fld < t1.numFields(); fld++)
{
	cout << t1.fieldName(fld) << "|";
}
原文链接:https://www.f2er.com/sqlite/198846.html

猜你在找的Sqlite相关文章