SmartView连接

时间:2018-08-03 12:16:07

标签: excel-vba

有人可以告诉我我在此编码上做错了什么吗?如果将(APPName更改为“ itmsales”)和(DBName更改为“ item”)并且(将HypConnect中的QACommonName更改为itmsales),则可以连接。但是,如果我将APPname,DBName和HypConnect更改为“ daily_05”,则什么也不会发生。 如果我将HypConnect更改为QACommonName(即“我的连接”),则会收到连接错误?

Declare Function HypConnect Lib "HsAddin" (
    ByVal vtSheetName As Variant, 
    ByVal vtUserName As Variant, 
    ByVal vtPassword As Variant, 
    ByVal vtFriendlyName As Variant
) As Long

Declare Function HypCreateConnection Lib "HsAddin" (
    ByVal vtSheetName As Variant, 
    ByVal vtUserName As Variant, 
    ByVal vtPassword As Variant, 
    ByVal vtProvider As Variant, 
    ByVal vtProviderURL As Variant, 
    ByVal vtServerName As Variant, 
    ByVal vtApplicationName As Variant, 
    ByVal vtDatabaseName As Variant, 
    ByVal vtFriendlyName As Variant, 
    ByVal vtDescription As Variant) As Long

Sub Example_HypCreateConnection()
    username = "SOME USER"
    password = "SOME PASSWORD"
    Provider = "SOME PROFICER"
    QAProvURL = "http://SOMEDOMAIN:19000/aps/SmartView"
    QAServer = "QASERVER-NAME"
    AppName = "daily_05"
    DBName = "daily_05"
    QACommonName = "My Connection"
    QADescription = "Analylic Provider Services"

    Y = HypCreateConnection(Empty, username, password, Provider, QAProvURL, QAServer, AppName, DBName, QACommonName, QADescription)

    X = HypConnect(Empty, username, password, QACommonName)
End Sub

0 个答案:

没有答案