Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Westi on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

sql won't execute HELP!!

Status
Not open for further replies.

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=&quot;1&quot; cellpadding=&quot;0&quot; cellspacing=&quot;0&quot; width=&quot;100%&quot;>
<tr>
<td width=&quot;20%&quot;><%rs(LAST_NAME)%></td>
<td width=&quot;20%&quot;> </td>
<td width=&quot;20%&quot;> </td>
<td width=&quot;20%&quot;> </td>
<td width=&quot;20%&quot;> </td>
</tr>
</table>
</body>

</html>
 
bettyMarkley,

I also noticed you don't specify any database in your connect statement.



fengshui_1998
 
Dear Betty
Markley is right
Yes ur connecition string is not correct
it should have SERVER and DATABASE name
srtConn = &quot;DRIVER=SQL Server;SERVER=;UID=;PWD=;DATABASE=&quot;
'this is causing problem indicates SERVER and DATABE name

Regards
Nouman
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top