' 2004/07/27 Zhu Yanzhi (Goodidea) myad@yeah.net
' Do you really hate using & a bunch of connection variables?
Do you have to use the "" and "" "frequently?
' It's like this:
' strfilter = strfilter & ' and [& Strfldname & '] like ' "& strvalue &" ""
'
' strSQL = ' insert INTO Tblpubstyle (Class,prop,value,type,[set],memo,flag) VALUES (' "& _
' CTL. ControlType & "', '" & _
' PRP. Name & "', '" & _
' PRP. Value & "', '" & _
' PRP. Type & "'," & _
' 2 & ', ' & _
' "," & _
' false ') "
'
' strcnn = Provider=sqloledb; ' & _
' "Data source=" & strServerName & ";" & _
' "Initial catalog=" & strDbName & ";" & _
"User id=" & Struid & ";" & _
' "Password=" & Strpwd & ";
'
' With it, gcombinationstring, this very simple function, makes verbose code more concise, enhances the readability of the statement
' The following is the typical form of its use:
' strfilter = gcombinationstring ("and [$] like" "$" ", Strfilter,strfldname,strvalue)
' Strcnn= gcombinationstring ("Provider=sqloledb;data source=$1;initial catalog=$2; User id=$3; password=$4; ", _
' strServerName, strDbName, Struid, strpwd
' The number of parameters is not limited, parameter type is not limited
' strSQL = gcombinationstring (insert into Tblpubstyle (Class,prop,value,type,[set],memo,flag) & _
' VALUES (' $ ', ' $ ', ' $ ', ' $ ', $5,$6) ', _
' CTL. ControlType, PRP. Name, PRP. Value, PRP. Type, 2, False)
'
Const Strcharpre = "$"
Dim Varitem as Variant
Dim I as Integer
i = 0
For each varitem in Para
i = i + 1
StrText = VBA. Replace (StrText, Strcharpre & I, Varitem)
StrText = VBA. Replace (StrText, Strcharpre & "\", Strcharpre)
Next
gcombinationstring = StrText
End Function