现有app.ini文件如下:
[database]
dbname=test
serverip=.
user=sa
password=
问题1:serverip=. .代表默认的SQL Server2000?
目标:通过单击一个按钮,实现显示数据表的内容
procedure TForm1.Button1Click(Sender: TObject);
var
myinifile:Tinifile;
filename,v_u,v_i,v_d,v_p:string;
begin
with ADOQuery1 do
begin
Filename:=ExtractFilePath(Paramstr(0))+'app.ini';
myinifile:=Tinifile.Create(Filename);v_u:=myinifile.readstring('database','user','');
v_i:=myinifile.readstring('database','serverip','');
v_d:=myinifile.readstring('database','dbname','');
v_p:=myinifile.readstring('database','password','');adoconnection1.Connected:=false;
adoconnection1.Close;
adoconnection1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=true;User ID='v_u)+';Initial Catalog='+v_i+';Data Source='+v_d+';password='+v_p;
adoconnection1.Connected:=true;adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select* from test');
adoquery1.Open;
end;
end;
麻烦各位朋友帮我看看
[database]
dbname=test
serverip=.
user=sa
password=
问题1:serverip=. .代表默认的SQL Server2000?
目标:通过单击一个按钮,实现显示数据表的内容
procedure TForm1.Button1Click(Sender: TObject);
var
myinifile:Tinifile;
filename,v_u,v_i,v_d,v_p:string;
begin
with ADOQuery1 do
begin
Filename:=ExtractFilePath(Paramstr(0))+'app.ini';
myinifile:=Tinifile.Create(Filename);v_u:=myinifile.readstring('database','user','');
v_i:=myinifile.readstring('database','serverip','');
v_d:=myinifile.readstring('database','dbname','');
v_p:=myinifile.readstring('database','password','');adoconnection1.Connected:=false;
adoconnection1.Close;
adoconnection1.ConnectionString:='Provider=SQLOLEDB.1;Persist Security Info=true;User ID='v_u)+';Initial Catalog='+v_i+';Data Source='+v_d+';password='+v_p;
adoconnection1.Connected:=true;adoquery1.Close;
adoquery1.SQL.Clear;
adoquery1.SQL.Add('select* from test');
adoquery1.Open;
end;
end;
麻烦各位朋友帮我看看
解决方案 »
- 急需delphi+fastreport 报表实例
- 新注册帐号,散分!!!
- 一个关于DOS批处理命令格式的问题
- sleep函数的用法,大家帮我看看
- 超难问题 !!!!! 如何 将 "内存流" 转成 "英文字符"???? 然后怎样把这些 "英文字符" 转 "内存流" ???????????? 急!!!!
- 关于SimpleDataSet.ApplyUpdates出错的问题
- 各位大哥大姐帮帮忙!
- 请教一个DBLookupComboBox的用法,!!!!!!!!!!!!!!!!!!!!!
- 如何判断鼠标移动的时候左键是否按下?
- 我们公司不让上QQ,不知道用代理服务器什么的可以上吗????
- combobox多级联动问题
- delphi7里如何播放amr格式的音乐?
ConnectionString:='Provider=SQLOLEDB.1;'+
'Password='+Password+';'+
'Persist Security Info=True;'+
'User ID='+UserName+';'+
'Initial Catalog='+DatabaseName+';'+
'Data Source='+ServerName;
DataModule1.ADOCon.Connected:=False;
DataModule1.ADOCon.ConnectionString:=ConnectionString;
DataModule1.ADOCon.Connected:=True;