Link to home
Start Free TrialLog in
Avatar of robertmayhue_iii
robertmayhue_iiiFlag for United States of America

asked on

Simple ADODB Recordset not working in Classic ASP

I have a very simple web page in classic ASP. I'm reading some recordsets from a SQL db and displaying the results on an asp page. I am having a problem with all of the fields showing. The following fields show (from the code below): Title, webpagemessage, rowid. The following do not show: message and icon. This is very weird and I have run across this before but do not know a solution.
<%
dim myConnss2, myRS2

Set myConnss2 = Server.CreateObject("ADODB.Connection")
myConnss2.ConnectionString = "driver={SQL Server};server=srvffhiint;Address=srvffhiint,1433;Network=DBMSSOCN;uid=test;pwd=test;database=ffhintranet;"
myConnss2.open
%>
<html>

<head>
</head>

<body>
                              
<%
Set myRS2 = myConnss2.Execute("SELECT * FROM currenteventstest order by RowID desc;")

dim mymessage2
Do while not myRS2.eof

%>

<%=myRS2("title")%><br>
<%=myRS2("webpagemessage")%><br>
<%=myRS2("message")%><br>
<%=myRS2("rowid")%><br>
<%=myRS2("icon")%>

<%
myRS2.movenext
Loop
%> 
						                            
                 
</body>
</html>
<%
Set myRS2 = Nothing
myConnss2.close
%>

Open in new window

Avatar of yourbudweiser
yourbudweiser

For sure those fields have data? Any errors on the page?
Avatar of robertmayhue_iii

ASKER

Those fields do have data and no errors.
ASKER CERTIFIED SOLUTION
Avatar of Wayne Barron
Wayne Barron
Flag of United States of America image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
In the code that I supplied above.
Remove line 22
Since you are not calling a Query, you do not need that line.
If you ever do need to do a Query, then please look at the article here.
https://www.experts-exchange.com/A_3626.html

This will show you everything that you need to know about running this type of code
And Running protected Queries against your database.

Good Luck and sorry for the extra un-needed line in the code.
Carrzkiss