在ADO连接中,SQL的缺省端口是1433,如果更改端口为7777则ADO如何设置呢?谢谢各位朋友!

解决方案 »

  1.   

    谢谢!但我的意思能否在DELPHI代码中实现!
      

  2.   

    "Provider=sqloledb;Data Source=190.190.200.100,7777;Network Library=DBMSSOCN;Initial Catalog=pubs;User ID=sa;Password=asdasd;" //IP地址后面设置端口号
      

  3.   

    找出解决方案,大家看:To connect via an IP address:oConn.Open "Provider=sqloledb;" & _
              "Data Source=xxx.xxx.xxx.xxx,1433;" & _
              "Network Library=DBMSSOCN;" & _
              "Initial Catalog=myDatabaseName;" & _
              "User ID=myUsername;" & _
              "Password=myPassword;" Note: 
    - xxx.xxx.xxx.xxx is an IP address
    - "Network Library=DBMSSOCN" tells OLE DB to use TCP/IP rather than Named Pipes (Q238949)
    - 1433 is the default port number for SQL Server(在这我们可以解决了!)
    - You can also add "Encrypt=yes" for encryption For more information, see: Microsoft OLE DB Provider for SQL Server