而重新开机,则行运行了程序,为什么,百思不得其解。有没见过这种问题的朋友。

解决方案 »

  1.   

    为什么采用认证方式,而不是你在SQL  里给自己开一个用户名和密码,用这个进去好了
      

  2.   

    呵呵,
    正如 bigchg(戴着戒指) 所述
    如果你的打印机放在WIN2K中,
    其它的计算机如果要打印必须先访问一下这台WIN2K才能打印,
      

  3.   

    打印的问题我也见过,
    总不能让用户每次开机后就认证一次吧
    请问你们是怎么解决的呢?]
     bigchg(戴着戒指) 
    什么是去系问问,?
      

  4.   

    如果你有Server的用户名和密码,使用API函数校验一下就是了!!================================================================
         ◆◆◆ CSDN查询助手,查询方便快捷◆◆◆ 下载地址:  
     http://CoolSlob.ifood1.com/Download/CSDNFinder.exe  
     http://CoolSlob.8u8.com/Download/Tools/CSDNFinder.Slob[更名为.exe即可]  
      

  5.   

    谢谢: CoolSlob(努力学习 工作 准备中) 给点具体的提示好不好!
      

  6.   

    去下载我帮的Demo:
    http://CoolSlob.ifood1.com/Download/Demo.exe1.输入Server的用户名与密码,
    2.输入Server端的任何一个共享目录
    3.Connect
    4.再运行你的程序看看,
    如果这样可以解决的问题的话,我再找代码,
    没用的活我就不费心思去找了:)
      

  7.   

    安装SQLSERVER时选择混合验证,再连接时用SQLSERVER的用户名就可以登上了
      

  8.   

    procedure TFmDial.BConnectClick(Sender: TObject);
    var
      RetCode: LongInt;
      ErrStr: String;
    begin
      RetCode := MapDrive(EDrive.Text, ERemoteName.Text, EUserName.Text, EPassword.Text, ErrStr);//在Dial单元应用
      MRetMsg.Clear;
      MRetMsg.Lines.Add(ErrStr);
    end;
    /////////这是Dial单元/////////
    unit Dial;interfaceuses Windows;  function MapDrive(const LocalName, RemoteName, UserName, Password: string; var ErrMsg: string): LongInt;
      function DelDrive(const LocalName: string; const Force: Boolean; var ErrMsg: string): Longint;implementationfunction MapDrive(const LocalName, RemoteName, UserName, Password: string; var ErrMsg: string): LongInt;
    var
      lpNetResource: TNetResource;
    begin
      lpNetResource.dwType := RESOURCETYPE_DISK;
      lpNetResource.lpLocalName := PChar(LocalName);
      lpNetResource.lpRemoteName := PChar(RemoteName);
      lpNetResource.lpProvider := Nil;
      Result := WNetAddConnection2(lpNetResource,
        PChar(Password), PChar(UserName), 0);  case Result of
        ERROR_ACCESS_DENIED: ErrMsg := 'Access to the network resource was denied.';
        ERROR_ALREADY_ASSIGNED: ErrMsg := 'The local device specified by lpLocalName is already connected to a network resource.';
        ERROR_BAD_DEV_TYPE: ErrMsg := 'The type of local device and the type of network resource do not match.';
        ERROR_BAD_DEVICE: ErrMsg := 'The value specified by lpLocalName is invalid.';
        ERROR_BAD_NET_NAME: ErrMsg := 'The value specified by lpRemoteName is not acceptable to any network resource provider. The resource name is invalid, or the named resource cannot be located.';
        ERROR_BAD_PROFILE: ErrMsg := 'The user profile is in an incorrect format.';
        ERROR_BAD_PROVIDER: ErrMsg := 'The value specified by lpProvider does not match any provider.';
        ERROR_BUSY: ErrMsg := 'The router or provider is busy, possibly initializing. The caller should retry.';
        ERROR_CANCELLED: ErrMsg := 'The attempt to make the connection was cancelled by the user through a dialog box from one of the network resource providers, or by a called resource.';
        ERROR_CANNOT_OPEN_PROFILE: ErrMsg := 'The system is unable to open the user profile to process persistent connections.';
        ERROR_DEVICE_ALREADY_REMEMBERED: ErrMsg := 'An entry for the device specified in lpLocalName is already in the user profile.';
        ERROR_EXTENDED_ERROR: ErrMsg := 'A network-specific error occured. Call the WNetGetLastError function to get a description of the error.';
        ERROR_INVALID_PASSWORD: ErrMsg := 'The specified password is invalid.';
        ERROR_NO_NET_OR_BAD_PATH: ErrMsg := 'A network component has not started, or the specified name could not be handled.';
        ERROR_NO_NETWORK: ErrMsg := 'There is no network present.';
        NO_ERROR: ErrMsg := '连接成功';
      else ErrMsg := '连接失败,发生未知错误';
      end;
    end;function DelDrive(const LocalName: string; const Force: Boolean; var ErrMsg: string): Longint;
    begin
      Result := WNetCancelConnection2(PChar(LocalName), 0, Force);
      case Result of
        ERROR_BAD_PROFILE: ErrMsg := 'The user profile is in an incorrect format.';
        ERROR_CANNOT_OPEN_PROFILE: ErrMsg := 'The system is unable to open the user profile to process persistent connections.';
        ERROR_DEVICE_IN_USE: ErrMsg := 'The device is in use by an active process and cannot be disconnected.';
        ERROR_EXTENDED_ERROR: ErrMsg := 'A network-specific error occurred. To get a description of the error, use the WNetGetLastError function.';
        ERROR_NOT_CONNECTED: ErrMsg := 'The name specified by the lpName parameter is not a redirected device, or the system is not currently connected to the device specified by the parameter.';
        ERROR_OPEN_FILES: ErrMsg := 'There are open files, and the fForce parameter is FALSE.';
        NO_ERROR: ErrMsg := '连接成功';
      else ErrMsg :
      

  9.   

    不好意思,CSDN的回复信息可能出了问题!!回复不了!LocalDrive为空''<--------------------当然你也可以指定L:等
    这里你仅仅是为了验证!所以空比较好btw:CoolSlob死了!
    详见:http://expert.csdn.net/Expert/TopicView1.asp?id=1060196================================================================
         ◆◆◆ CSDN查询助手,查询方便快捷◆◆◆ 下载地址:  
     http://CoolSlob.ifood1.com/Download/CSDNFinder.exe  
     http://CoolSlob.8u8.com/Download/Tools/CSDNFinder.Slob[更名为.exe即可]  
      

  10.   

    CoolSlob(努力学习 工作 准备中) 
    非常感谢你 ,我的问题已经解决
    我想问你的事,象这种情况,有种不好的地方是要在程序中帮定
    server 的window的用户名和密码
    以后有可能改动它的用户名和密码,那我的程序也要改,虽然可以把这些
    信息放在表里或注册表里,也要改相应的信息 ,请问,还有别的方法吗?
    不用那个API函数能做到吗?   再次表示感谢!