Recordset elements failing to write to page

Ask a Question related to ASP Database, Design and Development.

  1. #1

    Default 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

  2. Similar Questions and Discussions

    1. 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...
    2. 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...
    3. 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...
    4. 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...
    5. 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...
  3. #2

    Default 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

  4. #3

    Default 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

  5. #4

    Default 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

  6. #5

    Default 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

  7. #6

    Default 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

  8. #7

    Default 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...
    > 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
    >
    >

    Aaron Bertrand - MVP Guest

  9. #8

    Default 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...
    > 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
    >
    >

    Aaron Bertrand - MVP Guest

  10. #9

    Default 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...
    > 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
    >
    >

    Ray at Guest

  11. #10

    Default 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...
    > 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
    >
    >

    Ray at Guest

  12. #11

    Default 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

  13. #12

    Default 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

  14. #13

    Default 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

  15. #14

    Default 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

  16. #15

    Default 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...
    > 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...
    > > 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

  17. #16

    Default 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...
    > 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...
    > > 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

  18. #17

    Default 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

  19. #18

    Default 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

  20. #19

    Default 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...
    > > 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
    > > >
    > > >
    > >
    > >
    >
    >

    Aaron Bertrand - MVP Guest

  21. #20

    Default 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...
    > > 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
    > > >
    > > >
    > >
    > >
    >
    >

    Aaron Bertrand - MVP Guest

Posting Permissions

  • You may not post new threads
  • You may post replies
  • You may not post attachments
  • You may not edit your posts

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139