Results 1 to 8 of 8

Thread: [RESOLVED] Data is empty

  1. #1

    Thread Starter
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188

    Resolved [RESOLVED] Data is empty

    I am running this select statement against my MSSQL Database and some of the data is empty. When I running it in SQL Query - I see the data just fine. But in my ASP Page - nothing.
    In particular - questioname right now. Although, I had problems with each and every one of my fields below questionname.
    This code worked 100% fine against my MySQL Database - but not the MSSQL.
    Please help -

    Code:
    connstr="DSN=survey;UID=username;PWD=password"
    set conn=server.CreateObject("ADODB.Connection")
    conn.ConnectionTimeout=60
    conn.open=connstr
    sql="select id, [question] as questionname, [header] as hr, [row] as rowrow, questionno, keyword, maxanswers from eventsurveyquestion where survey='W' and id<>36 order by questionno, row"
    
    set res=conn.Execute(sql)
    
    do while not res.eof
            headerinfo = cstr(res("hr"))
            questionname = cstr(res("questionname"))
            lettername =  cstr(res("rowrow") )
            questionno = res("questionno")
    
            response.write questionname & "<BR>"
            res.movenext
    loop
    res.close
    conn.close
    VB 6 / VB.NET 2003, 2005 / Crystal Reports 9-12

  2. #2
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Re: Data is empty

    Does it work without the column aliasing?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  3. #3

    Thread Starter
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188

    Re: Data is empty

    nope. straight SQL select didn't work either.
    The header column is a "Y" or "N" only. It used to be 1 or 0 - but caused some issued in the same place.
    Now, when I moved the question above the header, the data showed up. Something about that header field, maybe the name... i dunno.
    Code:
    do while not res.eof
            questionname = cstr(res("questionname"))
            headerinfo = cstr(res("hr"))
            lettername =  cstr(res("rowrow") )
            questionno = res("questionno")
    
            response.write questionname & "<BR>"
            res.movenext
    loop
    VB 6 / VB.NET 2003, 2005 / Crystal Reports 9-12

  4. #4
    PowerPoster
    Join Date
    Jun 2001
    Location
    Trafalgar, IN
    Posts
    4,141

    Re: Data is empty

    Not sure it makes a difference but I would try the syntax

    questionname = res.Fields("questionname").Value

    You can also get away without the CStr.

  5. #5

    Thread Starter
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188

    Re: Data is empty

    it seems the question prefers to be first.
    if i out it second, third, fourth - no good.
    even trying: res.Fields("questionname").Value did not work.
    the header doesn't seem to work if i put it in the third or fourth position.
    so, in order for it to work, I have to do
    Question (string)
    Header (string)
    Row (string)
    QuestionNumber (integer)

    no other order works.
    VB 6 / VB.NET 2003, 2005 / Crystal Reports 9-12

  6. #6

    Thread Starter
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188

    Re: Data is empty

    just as a thought, I also tried
    Code:
    res.fields(0).value
    and if question (Field 1) is at the top, it works; otherwise, fail.

    someone with a similar issue, appears to be an MS Field Type problem:
    http://www.cjboco.com/blog.cfm/post/...g-empty-string

    My ASP field.type on Question is: 203 (adLongVarWChar [ie: ntext]). The other string fields (header, row) are type 200 (adVarChar).

    The link above explains what to do to fix it. However, the solution has 1 ntext field. what does one do with multiple ntext fields?

    Would love to hear if others are having this issue too with ColdFusion or ASP Pages... I do not think I am having this issue in VB.NET.
    Last edited by craigreilly; Jan 20th, 2011 at 08:36 PM.
    VB 6 / VB.NET 2003, 2005 / Crystal Reports 9-12

  7. #7
    Randalf the Red honeybee's Avatar
    Join Date
    Jun 2000
    Location
    off others' brains
    Posts
    4,345

    Re: Data is empty

    That's the first time I have come across a problem like this. What's the data in the Question field? Is it ordinary, or any special characters or stuff like that?

    .
    I am not a complete idiot. Some parts are still missing.
    Check out the rtf-help tutorial
    General VB Faq Thread
    Change is the only constant thing. I have not changed my signature in a long while and now it has started to stink!
    Get more power for your floppy disks. ; View honeybee's Elite Club:
    Use meaningfull thread titles. And add "[Resolved]" in the thread title when you have got a satisfactory response.
    And if that response was mine, please think about giving me a rep. I like to collect them!

  8. #8

    Thread Starter
    Addicted Member craigreilly's Avatar
    Join Date
    Jul 2004
    Location
    Scottsdale, AZ
    Posts
    188

    Re: Data is empty

    Not that I can see... standard Survey type questions:

    On a scale of 0%-100%; how would you rate your overall experience with our company?

    Seems straightforward.
    I will likely change to a character field instead of a text field to fix this up.
    VB 6 / VB.NET 2003, 2005 / Crystal Reports 9-12

Posting Permissions

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



Click Here to Expand Forum to Full Width