var filename:string; begin filename:='c:\test.mdb' adoconnection.connectionstring:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+filename+';Persist Security Info=False' end;
var filename:string; begin filename:='c:\test.mdb' adoconnection1.connectionstring:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+filename+';Persist Security Info=False' try adoconnection1.connected:=true; except end; end;
'Provider=Microsoft.Jet.OLEDB.4.0;Data Source=<your access file name>;Persist Security Info=False;Jet OLEDB:Database Password=<your password>'
begin
filename:='c:\test.mdb'
adoconnection.connectionstring:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+filename+';Persist Security Info=False'
end;
begin
filename:='c:\test.mdb'
adoconnection1.connectionstring:='Provider=Microsoft.Jet.OLEDB.4.0;Data Source='+filename+';Persist Security Info=False'
try
adoconnection1.connected:=true;
except
end;
end;
Provider=Microsoft.Jet.OLEDB.4.0;Password=123;Data Source=F:\人事管理.mdb;
Persist Security Info=True
新建工程->放个ADOConnection->双击ADOConnection->选择build->选择Microsoft.Jet.OLEDB.4.0 provider->选择一个MDB文件->测试连接,如果成功则OK。
Insert Into TableName(Field1, Field2..) Value(Value1, Value2..)
修改记录
UpDate TableName Set Field1 = Vaslue1, Field2 = Value2.. Where Field1 = ??
删除记录
Delete From TableName Where Field1 = ???
查询:放一个ADOQuery,连接到ADOConnection,程序中动态改变ADOQuery的SQl属性即可:
例如:
ADOQuery1.Close;
ADOQuery1.SQL.Text:='select * from 表名 where 编号>100';
ADOQuery1.OPen;
注意要另外给ADOQuery搭配一个DataSource和DBGrid。