N naughtboy Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-30 #2 {创建一个临时的ODBC数据源, 指向一个MsAccess数据库, 并利用此DSN建立一个数据库连接} AConnection := CreateOleObject('ADODB.Connection'); AConnection.Open('Driver={Microsoft Access Driver (*.mdb)};DBQ='+appPath+'accounts'); ARecordSet := CreateOleObject('ADODB.RecordSet'); ARecordSet.Open('accinfo',AConnection,adOpenStatic,adLockOptimistic,adCmdTable); if ARecordSet.RecordCount= 0 then exit;
{创建一个临时的ODBC数据源, 指向一个MsAccess数据库, 并利用此DSN建立一个数据库连接} AConnection := CreateOleObject('ADODB.Connection'); AConnection.Open('Driver={Microsoft Access Driver (*.mdb)};DBQ='+appPath+'accounts'); ARecordSet := CreateOleObject('ADODB.RecordSet'); ARecordSet.Open('accinfo',AConnection,adOpenStatic,adLockOptimistic,adCmdTable); if ARecordSet.RecordCount= 0 then exit;
A Alex_Y Unregistered / Unconfirmed GUEST, unregistred user! 2002-05-30 #3 导出函数SQLConfigDataSource function SQLConfigDataSource(hwndParent: Integer; fRequest: Integer; lpszDriverString: String; lpszAttributes: String): Integer; stdcall;external 'ODBCCP32.DLL'; 自动设置ODBC数据源,数据源名为DaChang SQLConfigDataSource(0, ODBC_ADD_DSN, 'Microsoft Access Driver (*.mdb)', 'DSN=DaChang' + Chr(0) +'Server=(local)' + Chr(0) + 'DBQ=' + ExtractFilePath(ParamStr(0)) + 'RecordDB.mdb' + Chr(0) + 'Description=Alex');
导出函数SQLConfigDataSource function SQLConfigDataSource(hwndParent: Integer; fRequest: Integer; lpszDriverString: String; lpszAttributes: String): Integer; stdcall;external 'ODBCCP32.DLL'; 自动设置ODBC数据源,数据源名为DaChang SQLConfigDataSource(0, ODBC_ADD_DSN, 'Microsoft Access Driver (*.mdb)', 'DSN=DaChang' + Chr(0) +'Server=(local)' + Chr(0) + 'DBQ=' + ExtractFilePath(ParamStr(0)) + 'RecordDB.mdb' + Chr(0) + 'Description=Alex');