Ask a Question related to ASP Database, Design and Development.
-
Greg Hurlman #1
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
Greg Hurlman Guest
-
Recordset page navigation
Hi , I have a page that get 1000 records and I?m displaying it 10 records a page. I want to use page numbers line 1,2,3, ...as my navigation instead... -
recordset paging won't show second page
Hi I'm querying a database and returning the records using absolute page and all that stuff. The user can choose to do a keyword search or... -
To can write with asp page and read to all
Hi workers, may be so simple but I think no, if you use an hosting service. I can't settings rwx permission as I like, so I'm thinking to... -
recordset not writing to page
Hi, Access2000 db, w2k, iis5 I am trying to write a couple recordsets to a page and the page doesn't throw an error, but it doesn't actualy... -
Common page elements in a site
Hi, I've designed an index page in Fireworks and some elements (eg the top menu) stay the same for the other pages i will do. But if I duplicate the... -
Greg Hurlman #2
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
Greg Hurlman Guest
-
Bob Barrows #3
Re: Recordset elements failing to write to page
Are any Memo fields involved? This sounds like the bug described here:
[url]http://www.aspfaq.com/show.asp?id=2188[/url]
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
Bob Barrows Guest
-
Bob Barrows #4
Re: Recordset elements failing to write to page
Are any Memo fields involved? This sounds like the bug described here:
[url]http://www.aspfaq.com/show.asp?id=2188[/url]
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
Bob Barrows Guest
-
Greg Hurlman #5
Re: Recordset elements failing to write to page
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" <reb_01501@yahoo.com> wrote in message
news:%2314Ra9hcDHA.3044@TK2MSFTNGP11.phx.gbl...> Are any Memo fields involved? This sounds like the bug described here:
> [url]http://www.aspfaq.com/show.asp?id=2188[/url]
>
> 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
>
Greg Hurlman Guest
-
Greg Hurlman #6
Re: Recordset elements failing to write to page
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" <reb_01501@yahoo.com> wrote in message
news:%2314Ra9hcDHA.3044@TK2MSFTNGP11.phx.gbl...> Are any Memo fields involved? This sounds like the bug described here:
> [url]http://www.aspfaq.com/show.asp?id=2188[/url]
>
> 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
>
Greg Hurlman Guest
-
Aaron Bertrand - MVP #7
Re: Recordset elements failing to write to page
Show your code.
"Greg Hurlman" <squaretwo@ghurlman.net> wrote in message
news:el#906hcDHA.300@TK2MSFTNGP12.phx.gbl...trying> I've got what I'm sure is a very simple problem. In an ASP page, I amto> 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)> 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
>
>
Aaron Bertrand - MVP Guest
-
Aaron Bertrand - MVP #8
Re: Recordset elements failing to write to page
Show your code.
"Greg Hurlman" <squaretwo@ghurlman.net> wrote in message
news:el#906hcDHA.300@TK2MSFTNGP12.phx.gbl...trying> I've got what I'm sure is a very simple problem. In an ASP page, I amto> 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)> 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
>
>
Aaron Bertrand - MVP Guest
-
Ray at #9
Re: Recordset elements failing to write to page
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" <squaretwo@ghurlman.net> wrote in message
news:el%23906hcDHA.300@TK2MSFTNGP12.phx.gbl...trying> I've got what I'm sure is a very simple problem. In an ASP page, I amto> 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)> 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
>
>
Ray at Guest
-
Ray at #10
Re: Recordset elements failing to write to page
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" <squaretwo@ghurlman.net> wrote in message
news:el%23906hcDHA.300@TK2MSFTNGP12.phx.gbl...trying> I've got what I'm sure is a very simple problem. In an ASP page, I amto> 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)> 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
>
>
Ray at Guest
-
jason kennedy #11
Re: Recordset elements failing to write to page
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" <squaretwo@ghurlman.net> wrote in message
news:uwyF$$hcDHA.3068@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" <reb_01501@yahoo.com> wrote in message
> news:%2314Ra9hcDHA.3044@TK2MSFTNGP11.phx.gbl...>> > Are any Memo fields involved? This sounds like the bug described here:
> > [url]http://www.aspfaq.com/show.asp?id=2188[/url]
> >
> > 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
> >
>
jason kennedy Guest
-
jason kennedy #12
Re: Recordset elements failing to write to page
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" <squaretwo@ghurlman.net> wrote in message
news:uwyF$$hcDHA.3068@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" <reb_01501@yahoo.com> wrote in message
> news:%2314Ra9hcDHA.3044@TK2MSFTNGP11.phx.gbl...>> > Are any Memo fields involved? This sounds like the bug described here:
> > [url]http://www.aspfaq.com/show.asp?id=2188[/url]
> >
> > 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
> >
>
jason kennedy Guest
-
Bob Barrows #13
Re: Recordset elements failing to write to page
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" <reb_01501@yahoo.com> wrote in message
> news:%2314Ra9hcDHA.3044@TK2MSFTNGP11.phx.gbl...>> Are any Memo fields involved? This sounds like the bug described
>> here: [url]http://www.aspfaq.com/show.asp?id=2188[/url]
>>
>> 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
Bob Barrows Guest
-
Bob Barrows #14
Re: Recordset elements failing to write to page
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" <reb_01501@yahoo.com> wrote in message
> news:%2314Ra9hcDHA.3044@TK2MSFTNGP11.phx.gbl...>> Are any Memo fields involved? This sounds like the bug described
>> here: [url]http://www.aspfaq.com/show.asp?id=2188[/url]
>>
>> 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
Bob Barrows Guest
-
Greg Hurlman #15
Re: Recordset elements failing to write to page
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:%23nZGhDicDHA.1872@TK2MSFTNGP12.phx.gbl...record)> 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" <squaretwo@ghurlman.net> wrote in message
> news:el%23906hcDHA.300@TK2MSFTNGP12.phx.gbl...> trying> > I've got what I'm sure is a very simple problem. In an ASP page, I am> > 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 testusername> 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>> > and domain name in the address.
> >
> > Thanks,
> > Greg
> >
> >
>
Greg Hurlman Guest
-
Greg Hurlman #16
Re: Recordset elements failing to write to page
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:%23nZGhDicDHA.1872@TK2MSFTNGP12.phx.gbl...record)> 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" <squaretwo@ghurlman.net> wrote in message
> news:el%23906hcDHA.300@TK2MSFTNGP12.phx.gbl...> trying> > I've got what I'm sure is a very simple problem. In an ASP page, I am> > 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 testusername> 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>> > and domain name in the address.
> >
> > Thanks,
> > Greg
> >
> >
>
Greg Hurlman Guest
-
Bob Barrows #17
Re: Recordset elements failing to write to page
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" <aaron@TRASHaspfaq.com> wrote in message
> news:Oxy9BDicDHA.2684@TK2MSFTNGP11.phx.gbl...>> Show your code.
>>
>>
>> "Greg Hurlman" <squaretwo@ghurlman.net> wrote in message
>> news:el#906hcDHA.300@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
Bob Barrows Guest
-
Bob Barrows #18
Re: Recordset elements failing to write to page
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" <aaron@TRASHaspfaq.com> wrote in message
> news:Oxy9BDicDHA.2684@TK2MSFTNGP11.phx.gbl...>> Show your code.
>>
>>
>> "Greg Hurlman" <squaretwo@ghurlman.net> wrote in message
>> news:el#906hcDHA.300@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
Bob Barrows Guest
-
Aaron Bertrand - MVP #19
Re: Recordset elements failing to write to page
Okay, now try:
<%
set conn = CreateObject("ADODB.Connection")
conn.open "<use a connection string from [url]http://www.aspfaq.com/2126[/url], 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" <squaretwo@ghurlman.net> wrote in message
news:e2EZVJicDHA.1128@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" <aaron@TRASHaspfaq.com> wrote in message
> news:Oxy9BDicDHA.2684@TK2MSFTNGP11.phx.gbl...> record)> > Show your code.
> >
> >
> > "Greg Hurlman" <squaretwo@ghurlman.net> wrote in message
> > news:el#906hcDHA.300@TK2MSFTNGP12.phx.gbl...> > trying> > > I've got what I'm sure is a very simple problem. In an ASP page, I am> > > 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> username> > 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>> >> > > and domain name in the address.
> > >
> > > Thanks,
> > > Greg
> > >
> > >
> >
>
Aaron Bertrand - MVP Guest
-
Aaron Bertrand - MVP #20
Re: Recordset elements failing to write to page
Okay, now try:
<%
set conn = CreateObject("ADODB.Connection")
conn.open "<use a connection string from [url]http://www.aspfaq.com/2126[/url], 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" <squaretwo@ghurlman.net> wrote in message
news:e2EZVJicDHA.1128@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" <aaron@TRASHaspfaq.com> wrote in message
> news:Oxy9BDicDHA.2684@TK2MSFTNGP11.phx.gbl...> record)> > Show your code.
> >
> >
> > "Greg Hurlman" <squaretwo@ghurlman.net> wrote in message
> > news:el#906hcDHA.300@TK2MSFTNGP12.phx.gbl...> > trying> > > I've got what I'm sure is a very simple problem. In an ASP page, I am> > > 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> username> > 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>> >> > > and domain name in the address.
> > >
> > > Thanks,
> > > Greg
> > >
> > >
> >
>
Aaron Bertrand - MVP Guest



Reply With Quote

