第一 先connection 資料庫 在database中 然後匯出ini檔案 然後修改下
string autocommit;製作datawindow 你要在window的open時間輸入如下**才能使顯示在資料庫中的資料string str_file = "baseini.ini";
if not fileexists(str_file) then
messagebox("錯誤","檔案不存在");
return
end if
string db ;
sqlca.dbms=profilestring( str_file,"database","dbms","")
db = sqlca.dbms
sqlca.database=profilestring(str_file,"database","database","")
sqlca.logid=profilestring(str_file,"database","logid","")
sqlca.logpass=profilestring(str_file,"database","logpassword","")
sqlca.dbparm=profilestring(str_file,"database","dbparm","")
autocommit=profilestring(str_file,"database","autocommit","")
if autocommit = "true" then
messagebox("tishi",db);
sqlca.autocommit=true
end if
if autocommit = "false" then
sqlca.autocommit=false
end if
connect;
if sqlca.sqlcode<>0 then
messagebox("提示","連線失敗"+sqlca.sqlerrtext);
else
messagebox("提示","okedsd");
end if
open(w_login)
long r
dw_2.settransobject(sqlca);
r=dw_2.retrieve( );
還有ini檔案的**
[database]
dbms=ole db
database="dd"
logid="sa"
logpassword=""
servername="2012-04182041"
dbparm=provider='sqloledb',datasource='2012-04182041',providerstring='database=dd'
prompt=false
autocommit=true
下面比較詳細
string autocommit;
string str = "erp.ini";
if not fileexists(str) then
messagebox("","檔案不存在");
return
end if
string db_dbms;
db_dbms=profilestring(str,"database","dbms","");
sqlca.dbms= db_dbms;
messagebox("", db_dbms);
string db_database;
db_database=profilestring(str,"database","database","");
sqlca.database=db_database;
messagebox("",db_database);
string db_logid;
db_logid=profilestring(str,"database","logid","");
sqlca.logid =db_logid;
messagebox("",db_logid);
string db_logpass;
db_logid=profilestring(str,"database","logpass","");
sqlca.logpass =db_logpass;
messagebox("",db_logpass);
string db_parm;
db_parm=profilestring(str,"database","dbparm","");
sqlca.dbparm =db_parm;
messagebox("",db_parm);
autocommit = profilestring(str,"database","autocommit","");
messagebox("",autocommit);
if autocommit="true" then
sqlca.autocommit=true;
else
sqlca.autocommit=false;
end if
connect using sqlca;
if sqlca.sqlcode <> 0 then
messagebox("",sqlca.sqlerrtext );
return;
else
messagebox("","success");
end if
使用python連線資料庫
使用python連線資料庫 import pymysql 第一步 連線資料庫 conn pymysql.connect host ip位址 port 埠,user 賬號 passwd 密碼 database 資料庫名 第二步 通過連線拿到游標 cursor conn.cursor try sql s...
使用sqlplus連線資料庫
sqlplus sjtu sjtu description address list address protocol tcp host 192.168.0.77 port 1521 connect data service name sjtu 如下圖所示 如下圖所示 方法1中的格式是固定的,我們在...
使用Spring連線資料庫
資料庫連線是一種關鍵 有限且昂貴的資源,建立和釋放資料庫連線是乙個很耗時的操作,頻繁地進行這樣的操作將占用大量的效能開銷,而使用資料庫連線池可以節省系統許多開銷。資料庫連線池 database connection pooling 在程式初始化時建立一定數量的資料庫連線物件並將其儲存在一塊記憶體區中...