473,657 Members | 2,418 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Changing order of recordsets creates non results

Hi,
I have used ASP for years using MS Access and have used MSSQL quite a lot as
well. I have never came across something like this before.

MSSQL table names and types:

ProductName nvarchar
ShortDescriptio n nText
ThumbNail nvarchar
etc

When I have the recordset in the order as follows, all works well:
(Recordset2.Fie lds.Item("Produ ctName").Value)
(Recordset2.Fie lds.Item("Short Description").V alue)
(Recordset2.Fie lds.Item("Thumb nail").Value)

Though if I have the Thumbnail first the description does'nt show.

Anybody got any ideas on this?

Kindest regards,
Kevin

Jun 21 '06 #1
13 2198
Kevin wrote:
Hi,
I have used ASP for years using MS Access and have used MSSQL quite a
lot as well. I have never came across something like this before.

MSSQL table names and types:

ProductName nvarchar
ShortDescriptio n nText
ThumbNail nvarchar
etc

When I have the recordset in the order as follows, all works well:
What do you mean "have the recordset in order"? Do you mean if you " put
the fields in the select statement that produces the recordset in that
order"?
(Recordset2.Fie lds.Item("Produ ctName").Value)
(Recordset2.Fie lds.Item("Short Description").V alue)
(Recordset2.Fie lds.Item("Thumb nail").Value)

Though if I have the Thumbnail first the description does'nt show.

We just had a long thread about this. Here's the aspfaq article:
http://www.aspfaq.com/show.asp?id=2188

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 21 '06 #2
Hi Bob,
Thanks for your speedy reply. What I mean is that depending on what order
the recordesets are used to display data on the page is dependant on whther
all the data is displayed. I will read that article you recommended. from
what i have read so far i am going to try adding all the colums instead of
just SELECT *.
Kindest regards,
Kevin


"Bob Barrows [MVP]" <re******@NOyah oo.SPAMcom> wrote in message
news:eV******** ******@TK2MSFTN GP05.phx.gbl...
Kevin wrote:
Hi,
I have used ASP for years using MS Access and have used MSSQL quite a
lot as well. I have never came across something like this before.

MSSQL table names and types:

ProductName nvarchar
ShortDescriptio n nText
ThumbNail nvarchar
etc

When I have the recordset in the order as follows, all works well:


What do you mean "have the recordset in order"? Do you mean if you " put
the fields in the select statement that produces the recordset in that
order"?
(Recordset2.Fie lds.Item("Produ ctName").Value)
(Recordset2.Fie lds.Item("Short Description").V alue)
(Recordset2.Fie lds.Item("Thumb nail").Value)

Though if I have the Thumbnail first the description does'nt show.

We just had a long thread about this. Here's the aspfaq article:
http://www.aspfaq.com/show.asp?id=2188

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"


Jun 21 '06 #3
> what i have read so far i am going to try adding all the colums instead of
just SELECT *.


Yes, NEVER, EVER use select * in production code.
Jun 21 '06 #4
Hi Aaron, Bob and everyone,
I just tried the solutions here http://www.aspfaq.com/show.asp?id=2188 and
added all the columns instead of using SELECT * though I still have the same
problem. I also found an old global.asa that used an older Access db rather
than the new mssql which I deleted. Any other thoughts on this would be much
appreciated.
Kindest regards,
Kevin

"Aaron Bertrand [SQL Server MVP]" <te*****@dnartr eb.noraa> wrote in message
news:uG******** ******@TK2MSFTN GP03.phx.gbl...
what i have read so far i am going to try adding all the colums instead
of just SELECT *.


Yes, NEVER, EVER use select * in production code.


Jun 21 '06 #5
Kevin wrote:
Hi Aaron, Bob and everyone,
I just tried the solutions here http://www.aspfaq.com/show.asp?id=2188 and
added all the columns
instead of using SELECT * though I still have the same problem. I
also found an old global.asa that used an older Access db rather than
the new mssql which I deleted. Any other thoughts on this would be
much appreciated.


We're pretty much in the dark here. You need to provide a small page that
reproduces your problem
("small" is the key word - leave out anything that has no bearing on
reproducing the problem.)
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 21 '06 #6
Kevin wrote:
What I mean is that depending on what order the recordesets
are used to display data on the page is dependant on whther
all the data is displayed.


"Displayed" is such a suspicion-inspiring word. What if you HTMLEncode the
values?

<%=Server.HTMLE ncode(Recordset 2.Fields("Produ ctName").Value) %>
<%=Server.HTMLE ncode(Recordset 2.Fields("Short Description").V alue)%>
<%=Server.HTMLE ncode(Recordset 2.Fields("Thumb nail").Value)%>

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message. Use
of this email address implies consent to these terms.
Jun 21 '06 #7
Thanks everyone for your input here is a basic part of the asp page in
question
select productname, shortdescriptio n, thumbnail from product where id = id

body of the page that works and displays the data

here is the product name
<%=Server.HTMLE ncode(Recordset 2.Fields("Produ ctName").Value) %><br>
here is the description
<%=Server.HTMLE ncode(Recordset 2.Fields("Short Description").V alue)%>
here is the thumbnail
<%=Server.HTMLE ncode(Recordset 2.Fields("Thumb nail").Value)%>

In the above order everything works, though if I change the order around as
below the description doesn't display:

here is the thumbnail
<%=Server.HTMLE ncode(Recordset 2.Fields("Thumb nail").Value)%>
here is the product name
<%=Server.HTMLE ncode(Recordset 2.Fields("Produ ctName").Value) %><br>
here is the description
<%=Server.HTMLE ncode(Recordset 2.Fields("Short Description").V alue)%>

Kindest regards,
Kevin



"Dave Anderson" <NY**********@s pammotel.com> wrote in message
news:Og******** ******@TK2MSFTN GP04.phx.gbl...
Kevin wrote:
What I mean is that depending on what order the recordesets
are used to display data on the page is dependant on whther
all the data is displayed.
"Displayed" is such a suspicion-inspiring word. What if you HTMLEncode the
values?

<%=Server.HTMLE ncode(Recordset 2.Fields("Produ ctName").Value) %>
<%=Server.HTMLE ncode(Recordset 2.Fields("Short Description").V alue)%>
<%=Server.HTMLE ncode(Recordset 2.Fields("Thumb nail").Value)%>

--
Dave Anderson

Unsolicited commercial email will be read at a cost of $500 per message.

Use of this email address implies consent to these terms.

Jun 21 '06 #8
km****@yahoo.co m wrote:
Thanks everyone for your input here is a basic part of the asp page in
question
I intended that you provide a complete working page that we could run on our
own web server and reproduce your problem (after creating your table in our
database of course). That is what is meant by "repro script"

Well, let's take a look anyways ...


select productname, shortdescriptio n, thumbnail from product where id
= id

body of the page that works and displays the data

here is the product name
<%=Server.HTMLE ncode(Recordset 2.Fields("Produ ctName").Value) %><br>
here is the description
<%=Server.HTMLE ncode(Recordset 2.Fields("Short Description").V alue)%>
here is the thumbnail
<%=Server.HTMLE ncode(Recordset 2.Fields("Thumb nail").Value)%>

In the above order everything works, though if I change the order
around as below the description doesn't display:

here is the thumbnail
<%=Server.HTMLE ncode(Recordset 2.Fields("Thumb nail").Value)%>
here is the product name
<%=Server.HTMLE ncode(Recordset 2.Fields("Produ ctName").Value) %><br>
here is the description
<%=Server.HTMLE ncode(Recordset 2.Fields("Short Description").V alue)%>

I thought you said you followed ALL the reccomendations in the aspfaq
article ... I can see right now that you did not follow the advice to
immediately assign the value contained in the description field to a
variable to be used in subsequent processing. IOW,

' ... open the recordset
dim desc
desc=Recordset2 .Fields("ShortD escription").Va lue
' do your other stuff ...
<%=Server.HTMLE ncode(desc)%>
Are you using ODBC or the native OLE DB provider for your database in your
connecton string? This behavior should not be occurring with the OLE DB
provider.

http://www.aspfaq.com/show.asp?id=2126

--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Jun 21 '06 #9
Hi Bob,
I hope this will suffice, I have been trying to get around the problem by
adding this but the result either way is the same in this order but if I put
the PPrice to the bottom of the list below I get the description to display:
<% PPrice = (Recordset2.Fie lds.Item("Retai l").Value)
title = (Recordset2.Fie lds.Item("Produ ctName").Value)
ID = (Recordset2.Fie lds.Item("ID"). Value)
SDesc = (Recordset2.Fie lds.Item("Short Description").V alue)
SPIC = (Recordset2.Fie lds.Item("Thumb nail").Value)
PayOText = (Recordset2.Fie lds.Item("PayOp tionText").Valu e)
ShipO=(Recordse t2.Fields.Item( "ShipOptionText ").Value)
SShipO = (Recordset2.Fie lds.Item("Speci alShippingText" ).Value)
STrade = (Recordset2.Fie lds.Item("Trade mark").Value)
%>

anyway this is the page, it's getting a bit messy now as i have tried many
things trying to get it to work.

<%@LANGUAGE="VB SCRIPT"%>
<!--#include file="Connectio ns/sql2k.asp" -->
<%
Dim Recordset2
Dim Recordset2_cmd
Dim Recordset2_numR ows
Dim ID, ProductName, ShortDescriptio n, Thumbnail, Logo, Retail ,
PayOptionText, ShipOptionText, SpecialShipping Text, BackOrderText, Guarantee
Dim Disclaimer, CSREmail, CategoryID, Category, Trademark, DateLastEdited,
CSRPhone, OrderTypeID, Video, CheckByPhoneYN
Set Recordset2_cmd = Server.CreateOb ject ("ADODB.Command ")
Recordset2_cmd. ActiveConnectio n = MM_sql2k_STRING
Recordset2_cmd. CommandText = "SELECT ID, ProductName, ShortDescriptio n,
Thumbnail, Logo, Retail , PayOptionText, ShipOptionText,
SpecialShipping Text, BackOrderText, Guarantee, Disclaimer, CSREmail,
CategoryID, Category, Trademark, DateLastEdited, CSRPhone, OrderTypeID,
Video, CheckByPhoneYN FROM Product WHERE ID =" &
Request.QuerySt ring("prodid")' "
Recordset2_cmd. Prepared = true

Set Recordset2 = Recordset2_cmd. Execute
Recordset2_numR ows = 0
%>
<%
PPrice = (Recordset2.Fie lds.Item("Retai l").Value)
title = (Recordset2.Fie lds.Item("Produ ctName").Value)
ID = (Recordset2.Fie lds.Item("ID"). Value)
SDesc = (Recordset2.Fie lds.Item("Short Description").V alue)
SPIC = (Recordset2.Fie lds.Item("Thumb nail").Value)
PayOText = (Recordset2.Fie lds.Item("PayOp tionText").Valu e)
ShipO=(Recordse t2.Fields.Item( "ShipOptionText ").Value)
SShipO = (Recordset2.Fie lds.Item("Speci alShippingText" ).Value)
STrade = (Recordset2.Fie lds.Item("Trade mark").Value)
%>
<br>
<img src="<%=SPIC%>" alt=""><br>
<%=(Recordset2. Fields.Item("Pr oductName").Val ue)%><br>
<br>
<%=SDesc%><br >
<%=(Recordset2. Fields.Item("Gu arantee").Value )%><br>

<br>
<br>
<%=PayOText%><b r>
<%=ShipO%><br >
<%=SShipO%><b r>
<p>
Order Online <img src="images/icon-lock.gif" border="0">: <a href =
"order.asp?id=< %=(Recordset2.F ields.Item("ID" ).Value)%>&AID= <%= AID %>"><img
src="images/tv-order.gif" width="127" height="22"></a> For <%= PPrice%>
</p>

<p> Order by Phone <img src="images/icon-phone.gif">: <font size="3"
color="#FF0000" ><strong><%=(Re cordset2.Fields .Item("CSRPhone ").Value)%> </str
ong></font></p>
<br>

<br>
STrade <%=STrade%><b r>
ShipC <%=ShipC%><br >
SShipC <%=SShipC%><b r>
STrade <%=STrade%><b r>
<img src="images/spacer.gif" width="10" height="5"><spa n class="boxes">
<table width="100%" border="0" cellspacing="0" cellpadding="5" >
<tr>
<td valign="top">
<h2><%= title %> Reviews:</h2>
<%
response.write "<p align='center'> Have you tried this product? Share
your experience:<br> <br><img src='images/icon-Thumbnail.gif'> <a
href='_reviews_ write.asp?ID=" & id & "'><b>Revie w " & title & " Now</b></a>
<img src='images/icon-Thumbnail.gif'> <br>or<br><stro ng align='center'> <img
src='images/icon-glasses.gif'> <a href='reviews.a sp?ID=" & id & "'>Read " &
title & " Reviews</a> <img src='images/icon-glasses.gif'></strong><ol>"

%>

</td>
</tr>
</table>
</span> </td>
</tr>
</table>
<p>&nbsp;</p>
<map name="Map">
<area shape="rect" coords="27,222, 137,249"
href="detail.as p?prodid=1079&A ID=<%= AID %>">
<area shape="rect" coords="74,341, 192,366" href="_reviews_ write.asp?ID=<% =
id %>">
<area shape="rect" coords="6,384,2 61,414" href="reviews.a sp?ID=<%= id %>">
</map>

</body>
</html>

<%
Recordset2.Clos e()
Set Recordset2 = Nothing
%>
Jun 21 '06 #10

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

2
2503
by: Paolo Pignatelli | last post by:
I am trying to get an output/file like this (below) in an XML file (MyXmlFile.xml) (which I will use for a slide show) -- <gallery timer="3" order="sequential" fadetime="2" looping="yes" xpos="0" ypos="0"> <image path="images2/Test1.jpg" />
1
2073
by: lakshmi | last post by:
Hi all, I recently rewrote a data intensive C++ program in C#. The C++ program was traversing 3 recordsets that were all open at the same time. I replaced those 3 recordsets with 3 .NET data readers and found that my C# code takes only about 35% of the time that the old C++ program took to execute. I'm amazed at this performance improvement, but finding it hard to believe. I'm supposed to make a recommendation based on my test results.
7
5258
by: Dan Sikorsky | last post by:
How do you iterate thru a dataset to change money fields to a different value? Here's what I have. My dataset is filled directly from a stored procedure. ' Create Instance of Connection and Command Object Dim myConnection As SqlConnection = New SqlConnection(ConfigurationSettings.AppSettings("ConnectionString")) Dim myCommand As New SqlDataAdapter("OrdersList", myConnection)
16
5717
by: Randy Harris | last post by:
I was inspired by the recent discussion of returning multiple recordsets to ADO from a stored procedure. (Amazed is probably more accurate). I asked about how to accomplish same with Oracle and got a nudge in the right direction from Mr. Kreft. I promised to provide details once working, so here it is. The code is shown below. My next step is to build this technique into my application. I'm hoping for substantial performance gain. ...
4
1508
by: mrmagoo | last post by:
I'm building a vb.net Forms project that is getting data from a SQL Server database. One of the main goals of the project is to be really responsive to events, such as textbox change events. I have a textbox for searching, a listbox to display the searched results, and a big textbox (memo) to display the clicked-results of the listbox item. My question is: should I load the controls with objects, and therefore store everything in...
1
371
by: Kevin | last post by:
Hi, I have used ASP for years using MS Access and have used MSSQL quite a lot as well. I have never came across something like this before. MSSQL table names and types: ProductName nvarchar ShortDescription nText ThumbNail nvarchar etc
9
76078
ADezii
by: ADezii | last post by:
There are basically 4 Methods that you can use to access the values of Fields in Recordsets. For the purposes of this demonstration, I'll be using a Table called tblEmployees, a Field named , and a DAO Recordset although these Methods are equally applicable to ADO Recordsets. The following code will print all the Last Name () values in the Employees (tblEmployees) Table using all 4 of these Methods. Dim MyDB As DAO.Database, MyRS As...
4
17382
by: stjulian | last post by:
(IIS 6.0, SQL Server 2000) I have a block of code that populates a recordset from a stored procedure. The problem is, the recordset seems to be forward only (which would be OK), but can't jump with the "AbsolutePage" property (which isn't OK) How do I define the recordset that will allow this? Julian
2
1627
by: =?Utf-8?B?R1ROMTcwNzc3?= | last post by:
Is it possible to put all recordsets in external files, reference the recordset through a server Side Include and then use the reordset to display data for instance, I have a search page that will post a value of x A search results page where the results of x are displayed, but the recordset is held on recordset1 page? Thanks
0
8402
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
8829
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
0
8734
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
0
8608
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
7341
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5633
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
4164
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
4323
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
2
1627
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating effective websites that not only look great but also perform exceptionally well. In this comprehensive...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.