客户端VB+Access,服务器端Sql Server,原来可以通过DTS包(BAS包)将客户端的数据上传到服务器,现在服务器1433端口改了,需要在客户端程序如何改动,才能正常上传数据呢。

解决方案 »

  1.   

    连接mssql的语句
               strCon = "Driver={mySQL};" & _ 
              "Server=服务器IP;" & _
              "Port=3306;" & _
              "Option=131072;" & _
              "Stmt=;" & _
              "Database=mydb;" & _
              "Uid=myUsername;" & _
              "Pwd=myPassword;" 你试试Port=1433
      

  2.   

    谢谢楼上回复。
    将DTS存为BAS包后,里面的信息保存如下:
    Dim oConnection As DTS.Connection2
    Set oConnection = goPackage.Connections.New("SQLOLEDB")        oConnection.ConnectionProperties("Persist Security Info") = True
            oConnection.ConnectionProperties("User ID") = "UserInformation"
            oConnection.ConnectionProperties("Initial Catalog") = "DataBaseInformation"
            oConnection.ConnectionProperties("Data Source") = strs
            oConnection.ConnectionProperties("Application Name") = "DTS 导入/导出向导"
            
            oConnection.Name = "连接2"
            oConnection.ID = 2
            oConnection.Reusable = True
            oConnection.ConnectImmediate = False
            oConnection.DataSource = strs
            oConnection.UserID = "UserInformation"
            oConnection.ConnectionTimeout = 60
            oConnection.Catalog = "DataBaseInformation"
            oConnection.UseTrustedConnection = False
            oConnection.UseDSL = False
            
            'If you have a password for this connection, please uncomment and add your password below.
            oConnection.Password = "PasswordInformation"goPackage.Connections.Add oConnection
    Set oConnection = Nothing
    现在就是不知道DataSource哪儿的变量strs该如何赋值。原来是直接赋值服务器IP的,现在服务器1433端口变了,不知道如何把1433写进去。
    客户端安装的是msde,我现在觉得如果是安装的sql客户端,是不是可以不改动程序,仅仅改动客户端连接工具中的服务器端口就可以了呢?
      

  3.   

    原来连接字符Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=127.0.0.1如果断口改成1430Provider=SQLOLEDB.1;Persist Security Info=False;User ID=sa;Initial Catalog=pubs;Data Source=127.0.0.1,1430
      

  4.   

    strCon = "Driver={mySQL};" & _ 
              "Server=202.118.86.6;" & "Port=1400;" & "Database=mydb;" & "Uid=myUsername;" & "Pwd=myPassword;"