in Programming

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
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, for illustration only,

conn = new SQLiteConnection("Data Source=" + dbFileName);
cmd.CommandText ="put your sql command here";
cmd.ExecuteNonQuery(); //execute command

3, C++SQLiteEncrypt, for illustration only,

CppSQLite3DB db;; //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) << "|";


Write a Comment


2 × five =