函式定義
/* 函式名稱 f_odbc_autoreg
函式功能 將拷貝到winsystem32 下的資料庫進行註冊
函式引數:mydb_name 將註冊資料庫名稱:
適用範圍pb9.0 sqlanywhere9.0 資料庫
實用注意事項:需將sqlanywhere9.0支援驅動 安裝到系統目錄
存在問題:執行後pb9.0 不能生成新的資料庫,有待解決
2006 - 11 已解決 設定引數大小寫問題.*/
constant long lensize=260
string str
str=space(lensize)
getsystemdirectory(str,lensize)
/自動設定odbc
int answer1,answer2,answer3,answer4,answer5,answer6,answer7,answer8,answer9,ing1,ing2,ing3,ing4,tag1,tag2,tag3
set odbc/odbcist.ini/odbc drvier
tag1 = registryget('hkey_local_machine/software/odbc/odbcinst.ini/odbc drivers','adaptive server anywhere 9.0',regstring!,tags1)
if tag1 = - 1 then
answer1=registryset('hkey_local_machine/software/odbc/odbcinst.ini/odbc drivers','adaptive server anywhere 9.0',regstring!,'installed')
end if
if answer1=-1 then
return -1
end if
ing1 = registryget('hkey_local_machine/software/odbc/odbcinst.ini/adaptive server anywhere 9.0','driver',regstring!,ins1)
ing2 = registryget('hkey_local_machine/software/odbc/odbcinst.ini/adaptive server anywhere 9.0','setup',regstring!,ins2)
if ing1= -1 or ing2= -1 then
answer2=registryset('hkey_local_machine/software/odbc/odbcinst.ini/adaptive server anywhere 9.0','driver',regstring!,ls_driver)
answer3=registryset('hkey_local_machine/software/odbc/odbcinst.ini/adaptive server anywhere 9.0','setup',regstring!,ls_driver)
if answer2=-1 or answer3=-1 then
return -1
end if
end if
///以上部分沒有資料庫資料
tag3 = registryget('hkey_current_user/software/odbc/odbc.ini/odbc data sources',&
mydb_name,regstring!,tags3)
if tag3 = -1 then
answer4=registryset('hkey_current_user/software/odbc/odbc.ini/odbc data sources',&
mydb_name,regstring!,'adaptive server anywhere 9.0')
end if
if answer4=-1 then
return -1
end if
answer1=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'autostop',regstring!,'yes')
answer2=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'databasefile',regstring!,db_path)
answer3=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'databasename',regstring!,mydb_name)
answer4=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'driver',regstring!,ls_driver)
answer5=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'integrated',regstring!,'no')
answer6=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'pwd',regstring!,'sql')
answer7=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'start',regstring!,db_start)
answer8=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'uid',regstring!,'dba')
answer9=registryset('hkey_current_user/software/odbc/odbc.ini/'+mydb_name,'autostop',regstring!,'yes')
if answer1=-1 or answer2=-1 or answer3=-1 or answer4=-1 or answer5=-1 or answer6=-1 or answer7=-1 or answer8=-1 then
return -1
end if
return 1
以下寫在應用的open事件
///自動註冊資料庫
string mydb
mydb = "tytank"
f_db_autoreg(mydb)
/資料庫聯結
// profile tank3
// profile tytank
sqlca.dbms = "odbc"
sqlca.autocommit = false
sqlca.dbparm = "connectstring='dsn=tytank;uid=;pwd='"
//資料庫相應驅動程式拷貝到系統目錄下
PB資料視窗物件之資料來源
pb提供5種資料來源 quickselect 快速選擇型別 sql select sql選擇型別 query 查詢型別 external 外部型別 和storedprocedure 儲存過程型別 quick select 只能從乙個資料表或者檢視中選取資料 無關聯的表或者檢視 sql select ...
FastReport註冊資料來源
using smart.controls 一 註冊引數 public override void initreport fastreport.report report 注意 經使用發現這種方法註冊引數有乙個致命的缺點,就是引數只能在報表首次建立時傳入,如果報表設計好想再加引數似乎不可能。考慮到後期...
PB 新增SQLSERVER資料來源的方法
transaction sqlzk sqlzk create transaction profile mdaq sqlzk.dbms ole db sqlzk.logpass 密碼 sqlzk.logid sa sqlzk.autocommit false sqlzk.dbparm provider...