delphi连接sql2000的问题

来源:百度知道 编辑:UC知道 时间:2024/07/01 00:30:58
如何用ADOQuery1及DataSource1进行连接,我已在DataSource1->dataset->ADOQuery1 ;DataSource1 ->sql->select * from 表名,那么connectionstring->怎么设置?

Provider=SQLOLEDB.1;Password=密码;Persist Security Info=True;User ID=用户名;Initial Catalog=默认连接的数据库,如Master;Data Source=ip地址

=======================================================
DBGrid1->DataSource1= DataSource1;
DataSource1->Dataset=ADOQuery1;
ADOQuery1->Connection=ADOConnection1;
ADOConnection1->ConnectionString="Provider=SQLOLEDB.1;Password=密码;Persist Security Info=True;User ID=用户名;Initial Catalog=默认连接的数据库,如Master;Data Source=ip地址";
========================================================================
ADOQuery1->close();
ADOQuery1->sql->text="select * from xxx";
ADOQuery1->open();

设置你所要连接的数据库

ADO的ConnectionString是ADO专门自定义的。查一下ADO的帮助文档啊。好像Delphi里面的属性编辑器,能够帮你建立连接字符串的。