L
ll
Hi,
I'm having a little trouble with the following code. For some reason,
when x=true, both parts of the If Then...Else statement are followed,
and the data winds up being in the Data Source in the Else section,
even though x tests positive as true (the response.write statement).
Could this be a problem with the variable or perhaps grouping?
Thanks,
Louis
========================
'begin conditional connection section
x=true
If x=true Then
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.open "Provider=SQLOLEDB.1;" &_
"Persist Security Info=False;" &_
"User ID=CopRandW;Password=Pharm_1110;" &_
"Initial Catalog=cop_pcms;" &_
"Data Source=COP-CPB-DAT"
set GetConnection = Conn
end function
response.write("hi - x is true!")
Else
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.open "Provider=SQLOLEDB.1;" &_
"Persist Security Info=False;" &_
"User ID=CopRandW;Password=Pharm_1110;" &_
"Initial Catalog=cop;" &_
"Data Source=COP-CPB-DAT"
set GetConnection = Conn
end function
response.write("hi - x is false!")
End If
'end conditional connection section
I'm having a little trouble with the following code. For some reason,
when x=true, both parts of the If Then...Else statement are followed,
and the data winds up being in the Data Source in the Else section,
even though x tests positive as true (the response.write statement).
Could this be a problem with the variable or perhaps grouping?
Thanks,
Louis
========================
'begin conditional connection section
x=true
If x=true Then
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.open "Provider=SQLOLEDB.1;" &_
"Persist Security Info=False;" &_
"User ID=CopRandW;Password=Pharm_1110;" &_
"Initial Catalog=cop_pcms;" &_
"Data Source=COP-CPB-DAT"
set GetConnection = Conn
end function
response.write("hi - x is true!")
Else
Function GetConnection()
dim Conn: Set Conn = CreateObject("ADODB.Connection")
Conn.open "Provider=SQLOLEDB.1;" &_
"Persist Security Info=False;" &_
"User ID=CopRandW;Password=Pharm_1110;" &_
"Initial Catalog=cop;" &_
"Data Source=COP-CPB-DAT"
set GetConnection = Conn
end function
response.write("hi - x is false!")
End If
'end conditional connection section