DTP


 
Lively discussions on the graphic arts and publishing — in print or on the web


Go Back   Desktop Publishing Forum > General Discussions > Web Site Building & Maintenance

 
 
Thread Tools Display Modes
Prev Previous Post   Next Post Next
Old 08-30-2018, 02:31 PM   #1
CarlSeiler
Member
 
CarlSeiler's Avatar
 
Join Date: Oct 2005
Location: Denton, TX
Posts: 280
Default ASP Classic, VBScript, and ADO

We have some old code on our site that is exposed to some longtime clients. For years, parts of it haven't returned the right data, and we've just worked with it. I got the assignment from the boss to figure out why it reads that way. As someone who has worked on LAMP stack and now Node and just barely dabbled in .NET, I don't quite know where to start, except that it's obvious that two of the fields in the query aren't being mapped from the recordset object to the ASP engine for display.


So, on this page, we have:
Code:
 <% 
    Set objConnection = Server.CreateObject("ADODB.Connection")  
    objConnection.Open "DSN=OurDSN"
    SQLQuery = "exec sp_thepayments " & Request.querystring("claimid")
    Set rsCustomersList = objConnection.Execute(SQLQuery)
     %>
Then in the table:


Code:
<tbody>
<%  Do Until rsCustomersList.EOF%>
      <tr>
        <td class="amount"><% if ISNULL(rsCustomersList("clmpmt_amt")) then %>
    <p>$0.00 <% else %> <%= formatcurrency (rsCustomersList("clmpmt_amt"))%> <% end if %> </td>
        <td><% if ISNULL(rsCustomersList("clmpmt_date")) then %>
    <p><% else %> <%= formatdatetime (rsCustomersList("clmpmt_date"),2)%> <% end if %> </td>
        <td><%= rsCustomersList("chk_nbr")%></td>
        <td><% if ISNULL(rsCustomersList("chk_date")) then %><p><% else %> <%= formatdatetime (rsCustomersList("chk_date"),2)%> <% end if %></td>
        <td><% strtype = rsCustomersList("clmpmt_type")%>
    <%If rsCustomersList("clmpmt_type") = "c" Then %>
    Customer<% Else %><%Response.Write(strtype)%>Vendor<% End If %>
    <%If IsEmpty(rsCustomersList("clmpmt_type")) Then%>
    &bull; rsCustomersList(&quot;clmpmt_type&quot;) is Empty
    <% Else %>
    &quot;<%= strtype%>&quot;
    <% End If %>
    </td>
        <td><%= rsCustomersList("wt_item")%></td>
        <td><%= rsCustomersList("claimobj_desc")%></td>
        <td><%= rsCustomersList("loss_name")%></td>
      </tr>
    <% rsCustomersList.MoveNext
     Loop %>
 </tbody>
So, what I'm finding through reading is that it's basically setting up a recordset object which is called rsCustomersList in this case. It processes each member of the recordset using the Do Until...Loop. On each loop, it creates a row in the table. The <%= %> seems to be a shortcut or alternative for the Response.Write() method. Each item in the rsCustomersList("...") style is a value in a column in the recordset represented by the column name in quotes for that particular row as it loops. Apparently, you can address the value of a column for that recordset row by specifying rsCustomersList("clmpmt_date") for example. However, what I'm finding is that it isn't able to display the values of Customer or Vendor based on the If rsCustomersList("clmpmt_type") = "c" Then... As you can see, it appears that strtype [and rsCustomersList("clmpmt_type") for that matter] are always empty. I added some test code in there, to verify that it is indeed empty. The code is working, I am just not getting the output I expect.

So, my first thought was that the query is not returning a value for that column, but tests on the SQL server for that stored procedure reveal that it is indeed working as intended. The SQL query is correct as written. The spelling of the column matches, too. Finally, I thought that maybe the stored procedure it is calling is not the one I'm looking at (maybe a different server instance or database), but no when I edit the stored procedure, the website displays different data, so I am working on the correct SQL query on the server. I thought maybe that it has something to do with the logic in the VBScript that is supposed to convert the "c" to Customer and everything else to Vendor, but no I'm having the same problem with the <%= rsCustomersList("loss_name")%> not displaying even when the SQL query in the stored procedure is returning values for "loss_name".

Anyone have any ideas or can point me how to debug this?
CarlSeiler is offline   Reply With Quote
 

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump

Similar Threads
Thread Thread Starter Forum Replies Last Post
One-day sale: Neue Aachen, Classic Grotesque, Rabenau Paul Fonts & Typography 0 02-20-2013 06:19 AM
Eudora Classic Question Andrew B. Software 11 11-27-2011 12:08 PM
Classic ASP VBScript code help please! LoisWakeman Web Site Building & Maintenance 4 06-22-2011 08:48 PM
Compuserve Classic ISP going bye-bye... terrie The Corner Pub 88 05-22-2009 04:14 PM


All times are GMT -8. The time now is 06:30 AM.


Powered by vBulletin® Version 3.8.9
Copyright ©2000 - 2018, vBulletin Solutions, Inc.
Contents copyright 2004–2018 Desktop Publishing Forum and its members.