Guest_imported
New member
- Jan 1, 1970
- 0
I have been working on this for a couple of days and I can not get this to work. I need to be able to pull up a report from the sql database into an html table using vbscript. My code is not working. Can anyone see what the problem is??
srtConn = "DRIVER=SQL Server;SERVER=;UID=;PWD=;DATABASE="
Set objDBConn = SERVER.CreateObject("ADODB.Connection"
objDBConn.Open strConn
strCommandText = "SELECT dbo.t_EMPLOYEES.CurrentComp," &_
"dbo.t_EMPLOYEES.LAST_NAME, " &_
"dbo.t_EMPLOYEES.FIRST_NAME, " &_
"dbo.t_EMPLOYEES.STATUS, " &_
"dbo.t_EMPLOYEES.POSITION, " &_
"dbo.t_EMPLOYEES.PROGRAM, " &_
"dbo.t_GOVERNMENT.JOB_SERIES, " &_
"dbo.t_GOVERNMENT.GRADE, " &_
"Left([CurrentComp],3) AS Comp, " &_
"dbo.t_EMPLOYEES.EmployeeID, " &_
"[LAST_NAME]&', '&[FIRST_NAME] AS Name " &_
"FROM dbo.t_EMPLOYEES, dbo.t_GOVERNMENT " &_
"JOIN dbo.t_GOVERNMENT ON dbo.t_EMPLOYEES.EmployeeID = dbo.t_GOVERNMENT.EmployeeID " &_
"GROUP BY dbo.t_EMPLOYEES.CurrentComp, dbo.t_EMPLOYEES.LAST_NAME, dbo.t_EMPLOYEES.FIRST_NAME, " &_
"dbo.t_EMPLOYEES.STATUS, dbo.t_EMPLOYEES.POSITION, dbo.t_EMPLOYEES.PROGRAM, dbo.t_GOVERNMENT.JOB_SERIES, " &_
"dbo.t_GOVERNMENT.GRADE, Left([CurrentComp],3), dbo.t_EMPLOYEES.EmployeeID, [LAST_NAME]&', '&[FIRST_NAME] " &_
"HAVING (((dbo.t_EMPLOYEES.LAST_NAME) Not Like 'VAC%') AND " &_
"((dbo.t_EMPLOYEES.STATUS) Like 'perman%' Or (dbo.t_EMPLOYEES.STATUS) Like '%term%')) " &_
"OR (((dbo.t_EMPLOYEES.LAST_NAME) Not Like 'vac%') AND ((dbo.t_EMPLOYEES.STATUS) Like 'perman%' " &_
" Or (dbo.t_EMPLOYEES.STATUS) Like 'term%')) " &_
"ORDER BY dbo.t_EMPLOYEES.CurrentComp, dbo.t_EMPLOYEES.LAST_NAME "
Set rsEmployee = objDBConn. Execute strCommandText, , _
adCmdText
%>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20%"><%rs(LAST_NAME)%></td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
</tr>
</table>
</body>
</html>
srtConn = "DRIVER=SQL Server;SERVER=;UID=;PWD=;DATABASE="
Set objDBConn = SERVER.CreateObject("ADODB.Connection"
objDBConn.Open strConn
strCommandText = "SELECT dbo.t_EMPLOYEES.CurrentComp," &_
"dbo.t_EMPLOYEES.LAST_NAME, " &_
"dbo.t_EMPLOYEES.FIRST_NAME, " &_
"dbo.t_EMPLOYEES.STATUS, " &_
"dbo.t_EMPLOYEES.POSITION, " &_
"dbo.t_EMPLOYEES.PROGRAM, " &_
"dbo.t_GOVERNMENT.JOB_SERIES, " &_
"dbo.t_GOVERNMENT.GRADE, " &_
"Left([CurrentComp],3) AS Comp, " &_
"dbo.t_EMPLOYEES.EmployeeID, " &_
"[LAST_NAME]&', '&[FIRST_NAME] AS Name " &_
"FROM dbo.t_EMPLOYEES, dbo.t_GOVERNMENT " &_
"JOIN dbo.t_GOVERNMENT ON dbo.t_EMPLOYEES.EmployeeID = dbo.t_GOVERNMENT.EmployeeID " &_
"GROUP BY dbo.t_EMPLOYEES.CurrentComp, dbo.t_EMPLOYEES.LAST_NAME, dbo.t_EMPLOYEES.FIRST_NAME, " &_
"dbo.t_EMPLOYEES.STATUS, dbo.t_EMPLOYEES.POSITION, dbo.t_EMPLOYEES.PROGRAM, dbo.t_GOVERNMENT.JOB_SERIES, " &_
"dbo.t_GOVERNMENT.GRADE, Left([CurrentComp],3), dbo.t_EMPLOYEES.EmployeeID, [LAST_NAME]&', '&[FIRST_NAME] " &_
"HAVING (((dbo.t_EMPLOYEES.LAST_NAME) Not Like 'VAC%') AND " &_
"((dbo.t_EMPLOYEES.STATUS) Like 'perman%' Or (dbo.t_EMPLOYEES.STATUS) Like '%term%')) " &_
"OR (((dbo.t_EMPLOYEES.LAST_NAME) Not Like 'vac%') AND ((dbo.t_EMPLOYEES.STATUS) Like 'perman%' " &_
" Or (dbo.t_EMPLOYEES.STATUS) Like 'term%')) " &_
"ORDER BY dbo.t_EMPLOYEES.CurrentComp, dbo.t_EMPLOYEES.LAST_NAME "
Set rsEmployee = objDBConn. Execute strCommandText, , _
adCmdText
%>
</head>
<body>
<table border="1" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td width="20%"><%rs(LAST_NAME)%></td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
<td width="20%"> </td>
</tr>
</table>
</body>
</html>