2个回答
展开全部
Ulong ul_num
Int answer,answer1,answer2,answer3,answer4,answer5,answer6,answer7
String ls_driver,db_path,dqml
dqml=GetCurrentDirectory ( )
//取得数据库驱动程序的路径
answer=RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Microsoft Access Driver (*.mdb)","driver",RegString!,ls_driver)
IF answer=-1 THEN
Messagebox("错误","应用程序无法获取Windows的系统目录,系统统将终止运行!",Stopsign!)
RETURN
END IF
//添加gw数据源
answer=RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\ODBC Data Sources','dlcl',RegString!,'Microsoft Access Driver (*.mdb)')
IF answer=-1 THEN
Messagebox('错误','应用程序无法设置ODBC DATA SOURCE名称,系统将终止运行',StopSign!)
RETURN
END IF
db_path=dqml+'\dianlicl.mdb'
//设置ODBC.INI的细节
answer1=RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","driver",RegString!,ls_driver)
answer2=RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","dbq",RegString!,db_path)
answer3=RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","fil",RegString!,'ms access')
RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","uid",RegString!,'')
Registryset("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","driverid",RegULong!, 25)
Registryset("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","safetransactions",RegULong!, 0)
//设置ODBC.INI\engines子健的细节
answer4=RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl','engines',RegString!,'')
answer5=RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','implicitcommitsync',RegString!,'')
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','usercommitsync',RegString!,'yes')
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','maxbuffersize',regulong!,2048)
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','pagetimeout',regulong!,5)
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','threads',regulong!,3)
IF answer1=-1 or answer4=-1 or answer5=-1 THEN
Messagebox('错误','应用程序无法设置odbc.ini,系统将终止运行',StopSign!)
RETURN
END IF
//连接数据源
sqlca.dbms='odbc'
sqlca.dbparm="connectstring='dsn=dianlicl'"
connect using sqlca;
if sqlca.sqlcode <> 0 then
MessageBox ("错误信息","数据连接失败!!~r1.检查网络是否连接~r2.请网管员来处理")
HALT CLOSE
return
else
open(w_main_x)
end if
Int answer,answer1,answer2,answer3,answer4,answer5,answer6,answer7
String ls_driver,db_path,dqml
dqml=GetCurrentDirectory ( )
//取得数据库驱动程序的路径
answer=RegistryGet("HKEY_LOCAL_MACHINE\SOFTWARE\ODBC\ODBCINST.INI\Microsoft Access Driver (*.mdb)","driver",RegString!,ls_driver)
IF answer=-1 THEN
Messagebox("错误","应用程序无法获取Windows的系统目录,系统统将终止运行!",Stopsign!)
RETURN
END IF
//添加gw数据源
answer=RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\ODBC Data Sources','dlcl',RegString!,'Microsoft Access Driver (*.mdb)')
IF answer=-1 THEN
Messagebox('错误','应用程序无法设置ODBC DATA SOURCE名称,系统将终止运行',StopSign!)
RETURN
END IF
db_path=dqml+'\dianlicl.mdb'
//设置ODBC.INI的细节
answer1=RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","driver",RegString!,ls_driver)
answer2=RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","dbq",RegString!,db_path)
answer3=RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","fil",RegString!,'ms access')
RegistrySet("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","uid",RegString!,'')
Registryset("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","driverid",RegULong!, 25)
Registryset("HKEY_current_user\Software\ODBC\odbc.ini\dianlicl","safetransactions",RegULong!, 0)
//设置ODBC.INI\engines子健的细节
answer4=RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl','engines',RegString!,'')
answer5=RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','implicitcommitsync',RegString!,'')
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','usercommitsync',RegString!,'yes')
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','maxbuffersize',regulong!,2048)
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','pagetimeout',regulong!,5)
RegistrySet('HKEY_current_user\Software\ODBC\ODBC.INI\dianlicl\engines\jet','threads',regulong!,3)
IF answer1=-1 or answer4=-1 or answer5=-1 THEN
Messagebox('错误','应用程序无法设置odbc.ini,系统将终止运行',StopSign!)
RETURN
END IF
//连接数据源
sqlca.dbms='odbc'
sqlca.dbparm="connectstring='dsn=dianlicl'"
connect using sqlca;
if sqlca.sqlcode <> 0 then
MessageBox ("错误信息","数据连接失败!!~r1.检查网络是否连接~r2.请网管员来处理")
HALT CLOSE
return
else
open(w_main_x)
end if
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询