I am creating a web page that performs a login to a outside source when clicking a Login button and then I want to perform a logout when clicking another button. The login succeeds fine but the values for the object is not retaining when the sub is exited. I declared the variable outside of the sub. Anything else I'm supposed to do? See code below:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Home</title>
<style type="text/css">
p.margin
{
margin-left:87px;
}
</style>
<SCRIPT language="VBScript">
Dim QCConnection
Sub cmdLogin_OnClick
Set QCConnection = CreateObject("TDAPIOLE80.TDConnection.1")
QCConnection.InitConnectionEx " QCConnection.login frmLoginPage.txtLoginName.Value, frmLoginPage.txtPassword.Value 'This returns success
If (Not QCConnection.LoggedIn) Then
MsgBox Err.Description, vbOK, "Quality Center Login"
Exit Sub
end if
QCConnection.Connect frmLoginPage.cboDomain.options(frmLoginPage.cboDomain.SelectedIndex).Text, frmLoginPage.cboProj.options(frmLoginPage.cboDomain.SelectedIndex).Text 'This returns success
if (Not QCConnection.ProjectConnected) then
MsgBox Err.Description, vbOK, "Quality Center Login"
Exit Sub
end if
End Sub
Sub cmdLogout_OnClick
QCConnection.Disconnect 'gives error that there isn't a connection
QCConnection.Logout
QCConnection.ReleaseConnection
End Sub
</SCRIPT>
</head>
<h1><center><b><big>Automated Test Runs</big></b></center></h1>
<body>
<form Name=frmLoginPage>
<p>Quality Center Login</p>
<p>Login Name: <input size="30" name="txtLoginName"></p>
<p> Password: <input size="30" type=password name="txtPassword"></p>
<p> Domain: <select name="cboDomain"><option>School_Systems</select></p>
<p> Project: <select name="cboProj"><option>PSX_2010</select></p>
<p class="margin"><button type="submit" style="height: 25px; width: 100px" name="cmdLogin">Login</button><p>
<p class="margin"><button type="submit" style="height: 25px; width: 100px" name="cmdLogout">Logout</button><p>
</form>
</body>
</html>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
<head>
<title>Home</title>
<style type="text/css">
p.margin
{
margin-left:87px;
}
</style>
<SCRIPT language="VBScript">
Dim QCConnection
Sub cmdLogin_OnClick
Set QCConnection = CreateObject("TDAPIOLE80.TDConnection.1")
QCConnection.InitConnectionEx " QCConnection.login frmLoginPage.txtLoginName.Value, frmLoginPage.txtPassword.Value 'This returns success
If (Not QCConnection.LoggedIn) Then
MsgBox Err.Description, vbOK, "Quality Center Login"
Exit Sub
end if
QCConnection.Connect frmLoginPage.cboDomain.options(frmLoginPage.cboDomain.SelectedIndex).Text, frmLoginPage.cboProj.options(frmLoginPage.cboDomain.SelectedIndex).Text 'This returns success
if (Not QCConnection.ProjectConnected) then
MsgBox Err.Description, vbOK, "Quality Center Login"
Exit Sub
end if
End Sub
Sub cmdLogout_OnClick
QCConnection.Disconnect 'gives error that there isn't a connection
QCConnection.Logout
QCConnection.ReleaseConnection
End Sub
</SCRIPT>
</head>
<h1><center><b><big>Automated Test Runs</big></b></center></h1>
<body>
<form Name=frmLoginPage>
<p>Quality Center Login</p>
<p>Login Name: <input size="30" name="txtLoginName"></p>
<p> Password: <input size="30" type=password name="txtPassword"></p>
<p> Domain: <select name="cboDomain"><option>School_Systems</select></p>
<p> Project: <select name="cboProj"><option>PSX_2010</select></p>
<p class="margin"><button type="submit" style="height: 25px; width: 100px" name="cmdLogin">Login</button><p>
<p class="margin"><button type="submit" style="height: 25px; width: 100px" name="cmdLogout">Logout</button><p>
</form>
</body>
</html>