I've got the following code....it returns null values for many of the columns in the query only ifI leave the IF and SELECT in the DO WHILE loop. If I take them out, things SEEM to work. However, that doesn't help.
There's nothing wrong with the db because I wrote a version in ColdFusion and it works perfectly.
<%@ Language = VBSCRIPT %>
<% Option Explicit %>
<!--#include file="adovbs.inc"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<!--#include file="stylesheet.css"-->
</head>
<body bgcolor="#CFB89F" leftmargin="0" topmargin="0">
<!--#include file="header.asp"-->
<%
Dim objConnTP
Set objConnTP = Server.CreateObject("ADODB.Connection"
objConnTP.ConnectionString = "Provider=MSDASQL;DSN=techies;UID=deleted;password=deleted;"
objConnTP.Open
Dim strSQL
strSQL = "SELECT TOP 6 ID, art_title, art_content, art_subject, art_page, art_next_page, art_macpc, art_author from thearticles WHERE art_parent = 0"
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
'objRS.MaxRecords = 6
objRS.Open strSQL, objConnTP
Dim strSubject, strMacPC, strLabel
Do While Not objRS.EOF
If (objRS("art_macpc" = 1) then
strMacPC = "In PC "
strLabel = "pc"
Elseif (objRS("art_macpc" = 2) then
strMacPC = "In Mac "
strLabel = "mac"
Else
strMacPC = "In PC/Mac "
strLabel = "pcmac"
End If
Select Case objRS("art_subject"
Case 1
strSubject = "Hardware"
strLabel = strLabel & "hardware.png"
Case 2
strSubject = "Apps"
strLabel = strLabel & "apps.png"
Case 3
strSubject = "Games"
strLabel = strLabel & "games.png"
Case 4
strSubject = "In ASP Development"
strMacPC = ""
strLabel = strLabel & "asp.png"
Case Else
strSubject = "In ColdFusion Development"
strMacPC = ""
strLabel = strLabel & "cf.png"
End Select
%><br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td colspan="3" width="400"><a href="subject.asp?subject=<%= objRS("art_subject" %>&macpc=<%= objRS("art_macpc" %>"><img src="images/label_<%= strLabel %>" width=175 height=20 alt="Latest Article" border="0"></a></td>
</tr>
<tr>
<td colspan="3" width="400" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
</tr>
<tr>
<td width="1" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
<td width="398"><table><tr><td><font class="basictext">
<%
Response.Write "<a href='article.asp?id=" & objRS("ID" & "&page=" & objRS("art_page" &"'><b>" & objRS("art_title" & "</b></a><br>"
Response.Write objRS("art_content" & "<br>"
%>
</font></td></tr></table></td>
<td width="1" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
</tr>
<tr>
<td colspan="3" width="400" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
</tr>
</table>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConnTP.Close
Set objConnTP = Nothing
%>
<br>
<!--#include file="footer.asp"-->
</body>
</html>
------------------------------------
"Unclean beast! Get thee down! Be thou consumed by the fires that made thee!" - Brother Jacobus in Dragonslayer
There's nothing wrong with the db because I wrote a version in ColdFusion and it works perfectly.
<%@ Language = VBSCRIPT %>
<% Option Explicit %>
<!--#include file="adovbs.inc"-->
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>Untitled</title>
<!--#include file="stylesheet.css"-->
</head>
<body bgcolor="#CFB89F" leftmargin="0" topmargin="0">
<!--#include file="header.asp"-->
<%
Dim objConnTP
Set objConnTP = Server.CreateObject("ADODB.Connection"
objConnTP.ConnectionString = "Provider=MSDASQL;DSN=techies;UID=deleted;password=deleted;"
objConnTP.Open
Dim strSQL
strSQL = "SELECT TOP 6 ID, art_title, art_content, art_subject, art_page, art_next_page, art_macpc, art_author from thearticles WHERE art_parent = 0"
Dim objRS
Set objRS = Server.CreateObject("ADODB.Recordset"
'objRS.MaxRecords = 6
objRS.Open strSQL, objConnTP
Dim strSubject, strMacPC, strLabel
Do While Not objRS.EOF
If (objRS("art_macpc" = 1) then
strMacPC = "In PC "
strLabel = "pc"
Elseif (objRS("art_macpc" = 2) then
strMacPC = "In Mac "
strLabel = "mac"
Else
strMacPC = "In PC/Mac "
strLabel = "pcmac"
End If
Select Case objRS("art_subject"
Case 1
strSubject = "Hardware"
strLabel = strLabel & "hardware.png"
Case 2
strSubject = "Apps"
strLabel = strLabel & "apps.png"
Case 3
strSubject = "Games"
strLabel = strLabel & "games.png"
Case 4
strSubject = "In ASP Development"
strMacPC = ""
strLabel = strLabel & "asp.png"
Case Else
strSubject = "In ColdFusion Development"
strMacPC = ""
strLabel = strLabel & "cf.png"
End Select
%><br>
<table border="0" cellpadding="0" cellspacing="0" width="400">
<tr>
<td colspan="3" width="400"><a href="subject.asp?subject=<%= objRS("art_subject" %>&macpc=<%= objRS("art_macpc" %>"><img src="images/label_<%= strLabel %>" width=175 height=20 alt="Latest Article" border="0"></a></td>
</tr>
<tr>
<td colspan="3" width="400" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
</tr>
<tr>
<td width="1" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
<td width="398"><table><tr><td><font class="basictext">
<%
Response.Write "<a href='article.asp?id=" & objRS("ID" & "&page=" & objRS("art_page" &"'><b>" & objRS("art_title" & "</b></a><br>"
Response.Write objRS("art_content" & "<br>"
%>
</font></td></tr></table></td>
<td width="1" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
</tr>
<tr>
<td colspan="3" width="400" bgcolor="#60000F"><img src="images/blank.gif" width=1 height=1 alt="" border="0"></td>
</tr>
</table>
<%
objRS.MoveNext
Loop
objRS.Close
Set objRS = Nothing
objConnTP.Close
Set objConnTP = Nothing
%>
<br>
<!--#include file="footer.asp"-->
</body>
</html>
------------------------------------
"Unclean beast! Get thee down! Be thou consumed by the fires that made thee!" - Brother Jacobus in Dragonslayer