加入收藏 | 设为首页 | 会员中心 | 我要投稿 李大同 (https://www.lidatong.com.cn/)- 科技、建站、经验、云计算、5G、大数据,站长网!
当前位置: 首页 > 百科 > 正文

Simple DB process method in program

发布时间:2020-12-12 19:29:57 所属栏目:百科 来源:网络整理
导读: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

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

(编辑:李大同)

【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容!

    推荐文章
      热点阅读