Skip to main content
Participant
January 11, 2008
Question

DW CS3 vs DW8 Recordset code.

  • January 11, 2008
  • 2 replies
  • 346 views
I have recently loaded DW CS3 and find that if I edit a recordset it replaces the code, it generated by Dreamweaver 8 with new code that does not work. The new code will only allow the display of each field once, if I then attempt to display it again in the page there is a null value.

The code below is for a page using DW 8 record set. (I have removed much that should be there normally to keep the debug simple)

<%@LANGUAGE="VBSCRIPT"%>
<!--#include file="Connections/test.asp" -->
<%
Dim faqs
Dim faqs_numRows

Set faqs = Server.CreateObject("ADODB.Recordset")
faqs.ActiveConnection = MM_test_STRING
faqs.Source = "SELECT * FROM faq ORDER BY Popularity DESC"
faqs.CursorType = 2
faqs.CursorLocation = 2
faqs.LockType = 3
faqs.Open()

faqs_numRows = 0
%>
<html>
<head>
</head>
<body>
<p><%=(faqs.Fields.Item("Question").Value)%> / <%=(faqs.Fields.Item("Popularity").Value)%></p>
<p><%=(faqs.Fields.Item("Question").Value)%></p>
</body>
</html>
<%
faqs.Close()
Set faqs = Nothing
%>

This page shows the faq question followed by a forward slash and its' popularity and then shows the question again on a second line.

The code below is for a page using DW CS3 record set.

<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
<!--#include file="Connections/test.asp" -->
<%
Dim faqs
Dim faqs_cmd
Dim faqs_numRows

Set faqs_cmd = Server.CreateObject ("ADODB.Command")
faqs_cmd.ActiveConnection = MM_test_STRING
faqs_cmd.CommandText = "SELECT * FROM faq ORDER BY Popularity DESC"
faqs_cmd.Prepared = true

Set faqs = faqs_cmd.Execute
faqs_numRows = 0
%>
<html>
<head>
</head>
<body>
<p><%=(faqs.Fields.Item("Question").Value)%> / <%=(faqs.Fields.Item("Popularity").Value)%></p>
<p><%=(faqs.Fields.Item("Question").Value)%></p>
</body>
</html>
<%
faqs.Close()
Set faqs = Nothing
%>

Despite the body content being identical when I view the page the second question is missing.

They are on the same XP Pro system/site using the same Access database.

Can anyone spot the error please?
This topic has been closed for replies.

2 replies

Inspiring
January 12, 2008
Instead of

select * from myTable

write out the full list of fields. eg

select field1,field2 from mytable

and put the ntext fields at the end of the list.

--
Jules
http://www.charon.co.uk/products.aspx
Charon Cart
Ecommerce for ASP/ASP.NET


Inspiring
January 11, 2008
DW8 used ADODB.Recordset and set the CursorType = 2

http://www.w3schools.com/ado/prop_rs_cursortype.asp

adOpenDynamic 2 Uses a dynamic cursor. Additions, changes, and deletions by
other users are visible, and all types of movement through the Recordset are
allowed, except for bookmarks, if the provider doesn't support them.

In other words you could go through the recordset any way that you needed
to.

DW CS3 is using the ADODB.Command

http://msdn2.microsoft.com/en-us/library/ms808194.aspx

The returned Recordset object is always a read-only, forward-only cursor. If
you need a Recordset object with more functionality, first create a
Recordset object with the desired property settings, then use the Recordset
object's Open method to execute the query and return the desired cursor
type.

Not sure if this will work:

http://www.sitepoint.com/forums/showthread.php?t=439942

try adding this to your page:

faqs_cmd.ActiveConnection.CursorType = 2

http://msdn2.microsoft.com/en-us/library/ms675544(VS.85).aspx

--
Ken Ford
Adobe Community Expert - Dreamweaver
Fordwebs, LLC
http://www.fordwebs.com


"Badg Champion" <webforumsuser@macromedia.com> wrote in message
news:fm89mj$9is$1@forums.macromedia.com...
>I have recently loaded DW CS3 and find that if I edit a recordset it
>replaces
> the code, it generated by Dreamweaver 8 with new code that does not work.
> The
> new code will only allow the display of each field once, if I then attempt
> to
> display it again in the page there is a null value.
>
> The code below is for a page using DW 8 record set. (I have removed much
> that
> should be there normally to keep the debug simple)
>
> <%@LANGUAGE="VBSCRIPT"%>
> <!--#include file="Connections/test.asp" -->
> <%
> Dim faqs
> Dim faqs_numRows
>
> Set faqs = Server.CreateObject("ADODB.Recordset")
> faqs.ActiveConnection = MM_test_STRING
> faqs.Source = "SELECT * FROM faq ORDER BY Popularity DESC"
> faqs.CursorType = 2
> faqs.CursorLocation = 2
> faqs.LockType = 3
> faqs.Open()
>
> faqs_numRows = 0
> %>
> <html>
> <head>
> </head>
> <body>
> <p><%=(faqs.Fields.Item("Question").Value)%> /
> <%=(faqs.Fields.Item("Popularity").Value)%></p>
> <p><%=(faqs.Fields.Item("Question").Value)%></p>
> </body>
> </html>
> <%
> faqs.Close()
> Set faqs = Nothing
> %>
>
> This page shows the faq question followed by a forward slash and its'
> popularity and then shows the question again on a second line.
>
> The code below is for a page using DW CS3 record set.
>
> <%@LANGUAGE="VBSCRIPT" CODEPAGE="65001"%>
> <!--#include file="Connections/test.asp" -->
> <%
> Dim faqs
> Dim faqs_cmd
> Dim faqs_numRows
>
> Set faqs_cmd = Server.CreateObject ("ADODB.Command")
> faqs_cmd.ActiveConnection = MM_test_STRING
> faqs_cmd.CommandText = "SELECT * FROM faq ORDER BY Popularity DESC"
> faqs_cmd.Prepared = true
>
> Set faqs = faqs_cmd.Execute
> faqs_numRows = 0
> %>
> <html>
> <head>
> </head>
> <body>
> <p><%=(faqs.Fields.Item("Question").Value)%> /
> <%=(faqs.Fields.Item("Popularity").Value)%></p>
> <p><%=(faqs.Fields.Item("Question").Value)%></p>
> </body>
> </html>
> <%
> faqs.Close()
> Set faqs = Nothing
> %>
>
> Despite the body content being identical when I view the page the second
> question is missing.
>
> They are on the same XP Pro system/site using the same Access database.
>
> Can anyone spot the error please?
>