在form中放一个ADOCOnnection1,双击进入设置,选择第二项:use connection string .在"提供程序"中选择"Micosoft OLE DB Provider for SQL Server " 下一步在 选择或输入服务器名中我输入的是:127.0.0.1 ,选择"使用Windows NT 集成安全登入.然后在服务器上选择数据库.
为什么有时可以有时不可以?
为什么有时可以有时不可以?
解决方案 »
- 请问如何用代码控制treeview控件的最左边始终显露出来?
- ADOQuery.SQL.Add时,后面应该是Open还是ExecSQL?
- 各位高手:delphi2007有没有纯win32版的?
- 我该不该继续学Delphi?迷茫中......请大家多多指点.
- UDL文件损坏了。怎么恢复?急!!!
- 为什么不能注册COM对象??
- 求教FastReport问题,.....
- 怎么把 sTest='这是TestString' 赋给 PChar 变量 pVTest???在线等待。
- delphi中用什么来编辑资源文件
- bpg文件是做什么用的?com组件问题。
- 怎样知道托盘中已存在某个应用程序?
- 字符串问题,在线等
用 ping 127.0.0.1 试试
用Windows NT 集成安全登入.然后在服务器上选择数据库.
为什么有时可以有时不可以?
**********
选指定用户名和密码
用户名为SA 密码(我不知道)
var
ConnFile:TStringList;
SConn:wideString;
begin
ConnFile:=TStringList.Create;
with DBConn do
begin
SConn:='Provider='+ Provider+';';
SConn:=SConn+'Data Source='+Properties['Data Source'].Value+';';
SConn:=SConn+'User ID=' +Properties['User ID'].Value +';';
SConn:=SConn+'Password='+Properties['Password'].Value+';'; if (pos('SQLOLEDB',Provider)>0) then
begin
if Properties['Persist Security Info'].Value=true then
SConn:=SConn+'Persist Security Info=True;'
else
SConn:=SConn+'Persist Security Info=false;';
SConn:=SConn+'Initial Catalog='+Properties['Initial Catalog'].Value +';';
end;
end;
ConnFile.Text:=SConn;
ConnFile.Savetofile(ExtractFilePath(Application.ExeName)+'JGDSystem\ConnIni.dat');
ConnFile.Free;
end;