如何不通过ODBC用代码如何连接paradox数据库,并把数据库路径设为相对路径?with Adoconnection1 do
begin
close;
loginprompt:=false;
ConnectionString:='Provider=Microsoft ole db provider db provider for odbc drivers;Data Sod=\zizang\;Persist Security Info=False';
connected:=true;
open;
end;
解决方案 »
- 关于delphi中,ado的几个简单应用?
- delphi中如何获取远程访问者的IP
- DELPHI,JSP,PB你会选择哪一个?...... 人人有分!
- 表中记录的定位问题
- 在线等待。。如何将一个变量转给memo1???
- 有没有InstallShield完全版啊
- 我想学DELPHI,请问用什么版本好?D5?D6?D7?
- 一个初学者的诸多问题,不要嫌分少罗!谢谢!
- 求控件--TeeChart 和 Skin Engine for D6
- 请问在sql语句select中有“str(sum(ctclk.hjzl)/ctjhk.jh01*100/:gzr,5,2)”其中以gzr动态查询,这样写对吗?
- 谁有delphi的汉化包,当场给分!
- 大虾过来看看---我想找个单位做毕设
var
registerTemp : TRegistry;
bData : array[ 0..0 ] of byte;
begin
registerTemp := TRegistry.Create; //建立一个Registry实例
with registerTemp do
begin
RootKey:=HKEY_LOCAL_MACHINE;//设置根键值为HKEY_LOCAL_MACHINE//找到Software\ODBC\ODBC.INI\ODBC Data Sources
if OpenKey(’Software\ODBC\ODBC.INI\ODBC Data Sources’,True) then
begin //注册一个DSN名称
WriteString( ’MyAccess’, ’Microsoft Access Driver (*.mdb)’ );
end
else
begin//创建键值失败
memo1.lines.add(’增加ODBC数据源失败’);
exit;
end;
CloseKey;//找到或创建Software\ODBC\ODBC.INI\MyAccess,写入DSN配置信息
if OpenKey(’Software\ODBC\ODBC.INI\MyAccess’,True) then
begin
WriteString( ’DBQ’, ’C:\inetpub\wwwroot\test.mdb’ );//数据库目录
WriteString( ’Description’, ’我的新数据源’ );//数据源描述
WriteString( ’Driver’, ’C:\PWIN98\SYSTEM\odbcjt32.dll’ );//驱动程序DLL文件
WriteInteger( ’DriverId’, 25 );//驱动程序标识
WriteString( ’FIL’, ’Ms Access;’ );//Filter依据
WriteInteger( ’SafeTransaction’, 0 );//支持的事务操作数目
WriteString( ’UID’, ’’ );//用户名称
bData[0] := 0;
WriteBinaryData( ’Exclusive’, bData, 1 );//非独占方式
WriteBinaryData( ’ReadOnly’, bData, 1 );//非只读方式
end
else//创建键值失败
begin
memo1.lines.add(’增加ODBC数据源失败’);
exit;
end;
CloseKey;//找到或创建Software\ODBC\ODBC.INI\MyAccess\Engines\Jet
//写入DSN数据库引擎配置信息
if OpenKey(’Software\ODBC\ODBC.INI\MyAccess\Engines\Jet’,True) then
begin
WriteString( ’ImplicitCommitSync’, ’Yes’ );
WriteInteger( ’MaxBufferSize’, 512 );//缓冲区大小
WriteInteger( ’PageTimeout’, 10 );//页超时
WriteInteger( ’Threads’, 3 );//支持的线程数目
WriteString( ’UserCommitSync’, ’Yes’ );
end
else//创建键值失败
begin
memo1.lines.add(’增加ODBC数据源失败’);
exit;
end;
CloseKey; memo1.lines.add(’增加新ODBC数据源成功’); Free;
end;
end;