strange ASP code behaviour

strange ASP code behaviour

am 09.03.2007 13:46:35 von cmt

Greetings

I have a web page with an ASP script in it that is not displaying all
the data from the SQL Server DB correctly in a form.

I have one line in the code, that is doing some strange things.

You can see the code below. The line in question is:

WTacctTotal = objRs("WTacctTotal")

If I move it to the front of the list, it displays the DB info fine
for that line, but for some reason, These lines are missing in the
form:

WTenteredBy = objRS("WTenteredBy")
WTenteredDate = objRS("WTenteredDate")
WTmodifiedBy = objRS("WTmodifiedBy")
WTmodifiedDate = objRS("WTmodifiedDate")

If move it to the end of the list, the above lines display, but then
WTacctTotal doesn't display.

strQry = "select * from worktask where WTid = '" & WTid & "'"
objRS.Open strQry,GetMSSQLConn()
'Response.Write strQry & "
"
WTacctTotal = objRs("WTacctTotal") 'strange line
WTlinkItemID = objRS("WTlinkItemID")
WTtaskTypeID = objRS("WTtaskTypeID")
WTworkEventTypeID = objRS("WTworkEventTypeID")
WTstatusID = objRS("WTstatusID")
WTcompleteByDate = objRS("WTcompleteByDate")
WTbillableAmount = objRS("WTbillableAmount")
WTbudgetAmount = objRS("WTbudgetAmount")
WTbudgetDate = objRS("WTbudgetDate")
WTenteredBy = objRS("WTenteredBy")
WTenteredDate = objRS("WTenteredDate")
WTmodifiedBy = objRS("WTmodifiedBy")
WTmodifiedDate = objRS("WTmodifiedDate")
WToriginalBudgetAmount = objRS("WToriginalBudgetAmount")
WTreductionReason = objRs("WTreductionReason")
WTfreetimeReason = objRs("WTfreetimeReason")
WTextended = objRs("WTextended")
WTmustGo = objRs("WTmustGo").Value
WTweather = objRs("WTweather").Value
WTwaiting = objRs("WTwaiting").Value

objRS.Close


I am displaying the data in a form like this:

value='<%=WTacctTotal%>'>

As you can see, I am doing nothing crazy. Just pulling info from a DB,
assigning variables, then writing out in a form.

I can take the SQL query above, and run it in SQL Query Analyzer, and
verify that the data is there. And it is obviously there, because the
data displays correctly in the form if I move that one line to the
top. But then of course that prevents other lines from being
displayed.

I can't figure out what's going on here!

Re: strange ASP code behaviour

am 09.03.2007 14:28:53 von reb01501

cmt wrote:
> Greetings
>
> I have a web page with an ASP script in it that is not displaying all
> the data from the SQL Server DB correctly in a form.
>
> I have one line in the code, that is doing some strange things.
>
> You can see the code below. The line in question is:
>
> WTacctTotal = objRs("WTacctTotal")
>
> If I move it to the front of the list, it displays the DB info fine
> for that line, but for some reason, These lines are missing in the
> form:

It's an old ODBC bug, so you should start by following this advice:
http://www.aspfaq.com/show.asp?id=2126

And then read this:
http://www.aspfaq.com/show.asp?id=2096

And this:
http://databases.aspfaq.com/database/how-do-i-deal-with-memo -text-hyperlink-and-currency-columns.html

--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.

Re: strange ASP code behaviour

am 09.03.2007 14:52:03 von cmt

On Mar 9, 8:28 am, "Bob Barrows [MVP]"
wrote:
> cmt wrote:
> > Greetings
>
> > I have a web page with an ASP script in it that is not displaying all
> > the data from the SQL Server DB correctly in a form.
>
> > I have one line in the code, that is doing some strange things.
>
> > You can see the code below. The line in question is:
>
> > WTacctTotal = objRs("WTacctTotal")
>
> > If I move it to the front of the list, it displays the DB info fine
> > for that line, but for some reason, These lines are missing in the
> > form:
>
> It's an old ODBC bug, so you should start by following this advice:http://www.aspfaq.com/show.asp?id=2126
>
> And then read this:http://www.aspfaq.com/show.asp?id=2096
>
> And this:http://databases.aspfaq.com/database/how-do-i-deal-with -memo-text-hyp...
>
> --
> Microsoft MVP -- ASP/ASP.NET
> Please reply to the newsgroup. The email account listed in my From
> header is my spam trap, so I don't check it very often. You will get a
> quicker response by posting to the newsgroup.

OMG...that was it. Instead of using SELECT *, I named all the columns
individually and put the offending column WTacctTotal at the end. It
worked! -THANKS!