在一台电脑上连接本地SQL SERVER,换了台机子也是SQL SERVER,但是名称不同
现在在这两台电脑上运行程序是,都要在设计期更改connectionstring,用了
ADODB.DATASOURCEPROMPT之后连接字符串里的persist security info =false,连接不上
这是为什么啊??
有没有更好的方法在多台电脑之间移植本地SQL SERVER 的数据库应用程序啊??
多谢指教了

解决方案 »

  1.   

    將連接參數寫在INI文件中, 然後程序運行時動態取得連接參數
      

  2.   

    你可以再设计一个连接数据库窗体供用户选择数据库之类的,
      serverName:=Trim(edServerName.Text);
      lgnId:=Trim(edLgnID.Text);
      lgnPwd:=trim(edPwd.Text);
      intialDataBase:=trim(edDataBase.Text);
      Result:=adoConStr;
      if ServerName<>'' then
        Result:=Result+';Data Source='+ServerName ;
      if lgnId<>'' then
        Result:=Result+';User ID='+lgnId ;
      if lgnPwd<>'' then
        Result:=Result+';Password='+lgnPwd;
      if lgnTimeOut>0 then
        Result:=Result+';Connect Timeout='+IntToStr(lgnTimeOut);
      if intialDataBase<>'' then
        Result:=Result+';Initial Catalog='+intialDataBase;
    这样的话不管拿到哪台电脑上,只要有数据库都可以连接!~不知我说的是不是符合你的要求呢?
      

  3.   

    那么运行时如何取得一台计算机SQL SERVER 的参数呢??