【VB6笔记-02】从Command中获取链接参数

Public Sub GetParameters()
                Dim Para As String
                
                Para = Command$()
                gstrUserID = GetCommandPara(Para, 1)
                gstrDSN = GetCommandPara(Para, 2)
                gstrSQLUserID = GetCommandPara(Para, 3)
                gstrPassWord = GetCommandPara(Para, 4)
                gstrServerName = GetCommandPara(Para, 5)
                gstrDataBaseName = GetCommandPara(Para, 6)
                gstrCompanyCode = GetCommandPara(Para, 7)
                
                gblnAllowAdd = IIf(UCase(GetCommandPara(Para, 8)) = "Y", True, False)
                gblnAllowEdit = IIf(UCase(GetCommandPara(Para, 9)) = "Y", True, False)
                gblnAllowDelete = IIf(UCase(GetCommandPara(Para, 10)) = "Y", True, False)
                gblnAllowSpecial = IIf(UCase(GetCommandPara(Para, 11)) = "Y", True, False)
End Sub


Public Function GetCommandPara(CommandStr As String, ParaNum As Integer) As String
        
            #If c_IssueVersion Then
                On Error GoTo GetCommandPara_Err
            #End If
            
            Dim OrigCmdStr As String
            Dim i As Integer
            Dim j As Integer
            ReDim PosArray(0 To 20)
            
            OrigCmdStr = RTrim$(LTrim$(CommandStr))
            PosArray(0) = 0
            j = 1
            
            For i = 1 To Len(OrigCmdStr)
                If Mid$(OrigCmdStr, i, 1) = "~" Then
                    PosArray(j) = i
                    j = j + 1
                End If
            Next i
            
            PosArray(j) = Len(OrigCmdStr) + 1
            GetCommandPara = Mid$(OrigCmdStr, PosArray(ParaNum - 1) + 1, PosArray(ParaNum) - PosArray(ParaNum - 1) - 1)
            
            Exit Function
GetCommandPara_Err:
            Call ErrHandler("The application can not get information to Login Server!", "Load Form")
End Function

 

转载于:https://www.cnblogs.com/allen0118/p/3726399.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值