Solved

Simple ADODB Recordset not working in Classic ASP

Posted on 2010-09-21
4
557 Views
Last Modified: 2012-05-10
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

0
Comment
Question by:robertmayhue_iii
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 3

Expert Comment

by:yourbudweiser
ID: 33728594
For sure those fields have data? Any errors on the page?
0
 

Author Comment

by:robertmayhue_iii
ID: 33728932
Those fields do have data and no errors.
0
 
LVL 31

Accepted Solution

by:
Wayne Barron earned 250 total points
ID: 33729653
Can you give this a shot and see if it displays your records?

Carrzkiss
<%
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 Mysql = Server.CreateObject("ADODB.Command")
Mysql.ActiveConnection=myConnss2
Mysql.Prepared = true
Mysql.commandtext="SELECT rowid, title, webpagemessage, message, icon FROM currenteventstest order by RowID desc"
Mysql.Parameters.Append sqlUser.CreateParameter("@username", adVarChar, adParamInput, 25, strmegaun) 
set myRS2 = Mysql.execute

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

0
 
LVL 31

Expert Comment

by:Wayne Barron
ID: 33730772
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.
http://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
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Suggested Solutions

Title # Comments Views Activity
Html CheckBox obtain Its Value 5 43
Validating Date Part2 2 46
SQL to JSON 14 65
Table header must be on top 2 57
I have helped a lot of people on EE with their coding sources and have enjoyed near about every minute of it. Sometimes it can get a little tedious but it is always a challenge and the one thing that I always say is:   The Exchange of informatio…
Hello, all! I just recently started using Microsoft's IIS 7.5 within Windows 7, as I just downloaded and installed the 90 day trial of Windows 7. (Got to love Microsoft for allowing 90 days) The main reason for downloading and testing Windows 7 is t…
In an interesting question (https://www.experts-exchange.com/questions/29008360/) here at Experts Exchange, a member asked how to split a single image into multiple images. The primary usage for this is to place many photographs on a flatbed scanner…
How to Install VMware Tools in Red Hat Enterprise Linux 6.4 (RHEL 6.4) Step-by-Step Tutorial

734 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question