//我程序上的源码<br>var<br> ODBCreg: TRegistry;<br> DataFileName , sfilepath:string;<br>begin<br> sfilepath := GetCurrentDir + '/data/';<br> DataFileName := 'address';<br> ODBCreg := TRegistry.create;<br> ODBCreg.RootKey := HKEY_CURRENT_USER;<br> ODBCreg.OpenKey('SOFTWARE/ODBC/ODBC.INI/address', true);<br> try<br> ODBCreg.WriteString('Driver', 'C:/WINDOWS/System32/odbcjt32.dll');<br> ODBCreg.WriteString('DBQ', sfilepath + 'Address.dat');<br> ODBCreg.WriteString('FIL', 'MS Access;');<br> ODBCreg.WriteString('UID', '');<br> ODBCreg.WriteInteger('SafeTransactions', 0);<br> ODBCreg.WriteInteger('DriverId', 25);<br> finally // wrap up<br> ODBCreg.CloseKey;<br> ODBCreg.Free;<br> end; // try/finally<br> ADOConnection1.ConnectionString :=<br> // 'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=' + Sfilepath + DataFileName +<br> // '.dat;Persist Security Info=False';<br> 'Provider=MSDASQL.1;Password=abc;Persist Security Info=True;Data Source=' + DataFileName;<br> if ADOConnection1.Connected = false then ADOConnection1.Connected := true;<br> ComboBoxField.Items.Clear;<br> Query1.Close;<br> Query1.SQL.Clear;<br> Query1.SQL.Add('select * from address');<br> query1.Open;<br> query1.GetFieldNames(ComboBoxField.Items);<br> ComboBoxField.Items.Delete(0);<br> ComboBoxField.Items.Delete(13);<br> Query1.Close;<br> Query1.SQL.Clear;<br> Query1.SQL.Add('select ID,姓名,性别,生日,电子邮件,籍贯,电话,手机,传真,单位,地址,职务,邮编,备注,' +<br> '录入时间 from ' + DataFileName + ' order by 姓名');<br> //session.AddPassword('enter');<br> Query1.open;<br>end;