473,385 Members | 1,402 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,385 software developers and data experts.

Recordset elements failing to write to page

I've got what I'm sure is a very simple problem. In an ASP page, I am trying
to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test record) to
be written out on the page. However, all I get is "LastNameSuffix"
(UserIII). If I move the FirstName and/or MiddleInitial to be written
first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the username
and domain name in the address.

Thanks,
Greg
Jul 19 '05 #1
10 2886
Are any Memo fields involved? This sounds like the bug described here:
http://www.aspfaq.com/show.asp?id=2188

Greg Hurlman wrote:
I've got what I'm sure is a very simple problem. In an ASP page, I am
trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test
record) to be written out on the page. However, all I get is
"LastNameSuffix" (UserIII). If I move the FirstName and/or
MiddleInitial to be written first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the
username and domain name in the address.

Thanks,
Greg

Jul 19 '05 #2
Sadly, no... the field definitions are these (from a SQL 2000 DB):

FirstName - varchar 50
MiddleInitial - char 1
LastName - varchar 50
Suffix - varchar 10

Thanks,
Greg

"Bob Barrows" <re*******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Are any Memo fields involved? This sounds like the bug described here:
http://www.aspfaq.com/show.asp?id=2188

Greg Hurlman wrote:
I've got what I'm sure is a very simple problem. In an ASP page, I am
trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test
record) to be written out on the page. However, all I get is
"LastNameSuffix" (UserIII). If I move the FirstName and/or
MiddleInitial to be written first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the
username and domain name in the address.

Thanks,
Greg


Jul 19 '05 #3
Show your code.
"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:el*************@TK2MSFTNGP12.phx.gbl...
I've got what I'm sure is a very simple problem. In an ASP page, I am trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test record) to be written out on the page. However, all I get is "LastNameSuffix"
(UserIII). If I move the FirstName and/or MiddleInitial to be written
first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the username
and domain name in the address.

Thanks,
Greg

Jul 19 '05 #4
What's in your View-Source?

Also, try

Response.Write Server.HTMLEncode(rs.Fields.Item(0).Value)
Response.Write Server.HTMLEncode(rs.Fields.Item(1).Value)
Response.Write Server.HTMLEncode(rs.Fields.Item(2).Value)
Response.Write Server.HTMLEncode(rs.Fields.Item(3).Value)

What does that yield?

Ray at work


"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:el***************@TK2MSFTNGP12.phx.gbl...
I've got what I'm sure is a very simple problem. In an ASP page, I am trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test record) to be written out on the page. However, all I get is "LastNameSuffix"
(UserIII). If I move the FirstName and/or MiddleInitial to be written
first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the username
and domain name in the address.

Thanks,
Greg

Jul 19 '05 #5
you're not using any conditional statements or trying to write out the
recordset data more than once?
could be your choice of recordset cursor

jason

"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:uw**************@TK2MSFTNGP11.phx.gbl...
Sadly, no... the field definitions are these (from a SQL 2000 DB):

FirstName - varchar 50
MiddleInitial - char 1
LastName - varchar 50
Suffix - varchar 10

Thanks,
Greg

"Bob Barrows" <re*******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Are any Memo fields involved? This sounds like the bug described here:
http://www.aspfaq.com/show.asp?id=2188

Greg Hurlman wrote:
I've got what I'm sure is a very simple problem. In an ASP page, I am
trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test
record) to be written out on the page. However, all I get is
"LastNameSuffix" (UserIII). If I move the FirstName and/or
MiddleInitial to be written first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the
username and domain name in the address.

Thanks,
Greg



Jul 19 '05 #6
You're going to have to give us more to go on. Show us the connection string
for your connection object (censor the user info of course) and the code
used to open your recordset.

Are you using ODBC or the native SQL OLEDB provider (recommended)?

FWIW, I've never experienced this problem.

Bob Barrows

Greg Hurlman wrote:
Sadly, no... the field definitions are these (from a SQL 2000 DB):

FirstName - varchar 50
MiddleInitial - char 1
LastName - varchar 50
Suffix - varchar 10

Thanks,
Greg

"Bob Barrows" <re*******@yahoo.com> wrote in message
news:%2****************@TK2MSFTNGP11.phx.gbl...
Are any Memo fields involved? This sounds like the bug described
here: http://www.aspfaq.com/show.asp?id=2188

Greg Hurlman wrote:
I've got what I'm sure is a very simple problem. In an ASP page, I
am trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test
record) to be written out on the page. However, all I get is
"LastNameSuffix" (UserIII). If I move the FirstName and/or
MiddleInitial to be written first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the
username and domain name in the address.

Thanks,
Greg

Jul 19 '05 #7
This yields the same result.

Also, from my View->Source...

<td>
UserIII
</td>

Where User is LastName, and III is Suffix.

Thanks,
Greg

"Ray at <%=sLocation%>" <myfirstname at lane34 dot com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
What's in your View-Source?

Also, try

Response.Write Server.HTMLEncode(rs.Fields.Item(0).Value)
Response.Write Server.HTMLEncode(rs.Fields.Item(1).Value)
Response.Write Server.HTMLEncode(rs.Fields.Item(2).Value)
Response.Write Server.HTMLEncode(rs.Fields.Item(3).Value)

What does that yield?

Ray at work


"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:el***************@TK2MSFTNGP12.phx.gbl...
I've got what I'm sure is a very simple problem. In an ASP page, I am trying
to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test record) to
be written out on the page. However, all I get is "LastNameSuffix"
(UserIII). If I move the FirstName and/or MiddleInitial to be written
first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the

username and domain name in the address.

Thanks,
Greg


Jul 19 '05 #8
Create a page with just the following server-side code in it (no html
stuff). Run it and let us know if you get the same result.

Bob

Greg Hurlman wrote:
My code:

Option Explicit
Response.Buffer = True

Dim rs, ID, SQL, cn, UserID

Set cn = Server.CreateObject("ADODB.Connection")
cn.Open Application("DSN")
SQL = "select * from RegisteredUsers where UserID='" & UserID & "'"
Set rs = cn.Execute(SQL)

Response.Write rs("FirstName")
Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("MiddleInitial")
...

I've left out HTML formatting code, but the code above represents all
DB interaction.

Thanks,
Greg
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:Ox**************@TK2MSFTNGP11.phx.gbl...
Show your code.
"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:el*************@TK2MSFTNGP12.phx.gbl...
I've got what I'm sure is a very simple problem. In an ASP page, I
am trying to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test
record) to be written out on the page. However, all I get is
"LastNameSuffix" (UserIII). If I move the FirstName and/or
MiddleInitial to be written first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the
username and domain name in the address.

Thanks,
Greg

Jul 19 '05 #9
Okay, now try:

<%
set conn = CreateObject("ADODB.Connection")
conn.open "<use a connection string from http://www.aspfaq.com/2126, not
an ODBC DSN>"
sql = "SELECT FirstName, LastName, Suffix, MiddleInitial" & _
" FROM RegisteredUsers WHERE UserID = '" & UserID & "'"
response.write sql & "<p>"
set rs = conn.execute(sql)
if not rs.eof then
response.write rs("FirstName") & "<br>"
response.write rs("LastName") & "<br>"
response.write rs("Suffix") & "<br>"
response.write rs("MiddleInitial") & "<br>"
else
response.write "Empty RS"
end if
rs.close: set rs = nothing
conn.close: set conn = nothing
%>

Key changes: (a) use an OLE-DB connection string, not a crappy DSN, (b)
*NAME* your columns, instead of lazy SELECT *, (c) test for EOF, (d) inspect
the actual SQL statement you're running (I don't see where you populate
UserID in your script).

Also, if UserID is a string, it is poorly named, IMHO. Appended "ID"
usually indicates a numeric column. If UserID is in fact a number, then
remove the single quotes around it.

"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...
My code:

Option Explicit
Response.Buffer = True

Dim rs, ID, SQL, cn, UserID

Set cn = Server.CreateObject("ADODB.Connection")
cn.Open Application("DSN")
SQL = "select * from RegisteredUsers where UserID='" & UserID & "'"
Set rs = cn.Execute(SQL)

Response.Write rs("FirstName")
Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("MiddleInitial")
...

I've left out HTML formatting code, but the code above represents all DB
interaction.

Thanks,
Greg
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:Ox**************@TK2MSFTNGP11.phx.gbl...
Show your code.
"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:el*************@TK2MSFTNGP12.phx.gbl...
I've got what I'm sure is a very simple problem. In an ASP page, I am

trying
to write out 4 fields from a recordset in succession:

Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("FirstName")
Response.Write rs("MiddleInitial")

All fields are populated and are single terms. I would expect
"LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test record)
to
be written out on the page. However, all I get is "LastNameSuffix"
(UserIII). If I move the FirstName and/or MiddleInitial to be written
first, I get "TestAUserIII".

What is the deal?

Please respond to the group, but email is ok too, just switch the

username and domain name in the address.

Thanks,
Greg



Jul 19 '05 #10
I implemented these changes one at a time, and moving from a DSN to a
connection string seems to have done the trick... in hindsight, this is
exactly the punishment the ASP gods should have given me for ignoring my
better judgement re: dsn after inheriting an old application.

Thanks for your help,
Greg

"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:%2****************@TK2MSFTNGP12.phx.gbl...
Okay, now try:

<%
set conn = CreateObject("ADODB.Connection")
conn.open "<use a connection string from http://www.aspfaq.com/2126, not an ODBC DSN>"
sql = "SELECT FirstName, LastName, Suffix, MiddleInitial" & _
" FROM RegisteredUsers WHERE UserID = '" & UserID & "'"
response.write sql & "<p>"
set rs = conn.execute(sql)
if not rs.eof then
response.write rs("FirstName") & "<br>"
response.write rs("LastName") & "<br>"
response.write rs("Suffix") & "<br>"
response.write rs("MiddleInitial") & "<br>"
else
response.write "Empty RS"
end if
rs.close: set rs = nothing
conn.close: set conn = nothing
%>

Key changes: (a) use an OLE-DB connection string, not a crappy DSN, (b)
*NAME* your columns, instead of lazy SELECT *, (c) test for EOF, (d) inspect the actual SQL statement you're running (I don't see where you populate
UserID in your script).

Also, if UserID is a string, it is poorly named, IMHO. Appended "ID"
usually indicates a numeric column. If UserID is in fact a number, then
remove the single quotes around it.

"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:e2**************@tk2msftngp13.phx.gbl...
My code:

Option Explicit
Response.Buffer = True

Dim rs, ID, SQL, cn, UserID

Set cn = Server.CreateObject("ADODB.Connection")
cn.Open Application("DSN")
SQL = "select * from RegisteredUsers where UserID='" & UserID & "'"
Set rs = cn.Execute(SQL)

Response.Write rs("FirstName")
Response.Write rs("LastName")
Response.Write rs("Suffix")
Response.Write rs("MiddleInitial")
...

I've left out HTML formatting code, but the code above represents all DB
interaction.

Thanks,
Greg
"Aaron Bertrand - MVP" <aa***@TRASHaspfaq.com> wrote in message
news:Ox**************@TK2MSFTNGP11.phx.gbl...
Show your code.
"Greg Hurlman" <sq*******@ghurlman.net> wrote in message
news:el*************@TK2MSFTNGP12.phx.gbl...
> I've got what I'm sure is a very simple problem. In an ASP page, I am trying
> to write out 4 fields from a recordset in succession:
>
> Response.Write rs("LastName")
> Response.Write rs("Suffix")
> Response.Write rs("FirstName")
> Response.Write rs("MiddleInitial")
>
> All fields are populated and are single terms. I would expect
> "LastNameSuffixFirstNameMiddleInitial" ("UserIIITestA" in my test

record)
to
> be written out on the page. However, all I get is "LastNameSuffix"
> (UserIII). If I move the FirstName and/or MiddleInitial to be written > first, I get "TestAUserIII".
>
> What is the deal?
>
> Please respond to the group, but email is ok too, just switch the

username
> and domain name in the address.
>
> Thanks,
> Greg
>
>



Jul 19 '05 #11

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

Similar topics

23
by: Rob Meade | last post by:
Lo all, Ok - this is what I was aiming to do, and then I thought - naahhh, that cant be right! query database results to recordset results to array using GetRows update values in one column...
8
by: dmiller23462 | last post by:
My brain is nuked....Can anybody tell me right off the bat what is wrong with this code? Along with any glaring errors, please let me know the syntax to display a message (Response.Write would be...
2
by: Mark | last post by:
Hi - I want to allow users of an intranet application, to select their own colours etc. So I have a tbale in my database, which has fields called bgcolour, fontcolour etc. As I want all pages...
27
by: Oscar | last post by:
I am looking for a way to pass an ADO recordset that has been retrieved in an ASP page to another HTML-page. Is there someone who can provide me with a small sample or a link to see how this is...
3
by: Jozef | last post by:
Hello, I'm hoping enough time has passed now that someone could tell me what methods have replaced the Database / Workspace / TableDef collections in Access XP. I've tried asking this question...
36
by: kjvt | last post by:
Based on a prior posting, I've written a function to convert a recordset to a dataview. The first call to the function for a given recordset works perfectly, but the second call always returns a...
9
by: Johnfli | last post by:
ADODB.Recordset error '800a0cb3' Current Recordset does not support bookmarks. This may be a limitation of the provider or of the selected cursortype. I am moving my webserver from NT4 using SQL...
5
by: slowmotiongenius | last post by:
All- I have established an adodb recordset in my code-behind, and I need to pass it to the aspx file. I can't seem to figure out if there is a way to do this. I see you can pass a string over...
2
by: Kosmos | last post by:
I am opening the following connections as such although I am only referring to the first connection for this question: Dim con1 As ADODB.Connection Dim con2 As ADODB.Connection Dim recSet1 As...
1
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.