DevX Home    Today's Headlines   Articles Archive   Tip Bank   Forums   

Results 1 to 3 of 3

Thread: Crystal Reports and asp problem!

  1. #1
    Join Date
    Jul 2007
    Posts
    2

    Crystal Reports and asp problem!

    Hello,

    I have recently taken over a site for someone. The site is built entirely in asp, which I am only somewhat familiar with. They are using Crystal reports to send a csv file to the web that is intern pulled and formatted on a separate web page for public viewing.

    The CSV file just appears as or almost like an xml file... using commas and quotes to separate and organize the information so the asp page can read it and pull it... The problem is that it is not pulling the entire CSV file and no matter how many times I look at the code I can not seem to find anything that would cause it do that... on either the asp page or the CSV... The asp page will pull about half the information.

    As far as I can tell they have not changed anything about the way the upload the csv file... However they did upgrade to crystal reports 9... which I thought may be a problem but it doesn't appear that anything has really changed in the export process. Any ideas? suggestions? thoughts?

    Any help would be greatly appreciated.
    Thanks

  2. #2
    Join Date
    Nov 2003
    Location
    Portland, OR
    Posts
    8,387
    I would need to see the file and the code that reads it in order to troubleshoot this problem. Is it possible that the file includes an embedded null character (Chr(0))? That might cause the code to think it has reached the end of the file.
    Phil Weber
    http://www.philweber.com

    Please post questions to the forums, where others may benefit.
    I do not offer free assistance by e-mail. Thank you!

  3. #3
    Join Date
    Jul 2007
    Posts
    2

    Crystal reports and ASP problem

    I checked for some kind of null character but was unable to find anything that might do that. I am starting to think that when they upgraded their Crystal Reports to version 9 it set to defaults or something... It is either the way the crystal reports is exporting the material or it is something they are doing when they enter it... I managed to get one report they sent me working... and this page pulled it fine...

    The asp is:


    '*** Open connection and set SQL
    '*** With Header
    If bHasHeaderRow Then
    on error resume next
    connOLEDB.Open "Driver={Microsoft Text Driver (*.txt; *.csv)};Dbq=" & sFilePath & ";Extensions=csv;Persist Security Info=False"
    If err.number <> 0 Then
    Call ErrorOccurred(sErrorMessage003, sErrorEmailRecipientAddress, sErrorEmailRecipientName)
    End If

    Select Case ucase(request("type"))
    Case "PIC"
    sSQL = "select * from [" & sDataSourceFileName & "] where ([GROUP] like '%PIC%' OR [GROUP] like '%ODDS%') order by BR asc, [MDL YR] asc, DESCRIPTION asc"
    strTitle = "BOBCAT OF ST LOUIS - MISCELLANEOUS ITEM LIST"
    Case "TAKE"
    sSQL = "select * from [" & sDataSourceFileName & "] where ([GROUP] like '%TAKE%') order by BR asc, [MDL YR] asc, DESCRIPTION asc"
    strTitle = "BOBCAT OF ST LOUIS - LAWN MOWERS FOR SALE"
    Case Else
    sSQL = "select * from [" & sDataSourceFileName & "] where ([GROUP] not like '%PIC%' AND [GROUP] not like '%ODDS%' AND [GROUP] not like '%TAKE%') order by BR asc, [MDL YR] asc, DESCRIPTION asc"
    strTitle = "BOBCAT OF ST LOUIS - USED MACHINE LIST-RETAIL"
    End Select

    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.CursorLocation = 3 'adUseClient
    rs.CursorType = 3 'adOpenStatic
    rs.LockType = 4 'adLockBatchOptimistic
    rs.open sSQL,connOLEDB
    Set rs.ActiveConnection = Nothing
    'rs.Open sSQL, connOLEDB, adOpenStatic, adLockReadOnly

    '*** Check format of the .CSV File (if not correct, send message to John Simpson and display error to user)
    sFieldNameList = "BR,MODEL,SERIAL,DESCRIPTION,SELLING PRICE,METER,MDL YR,GROUP"
    sFieldNames = Split(ucase(sFieldNameList),",")
    For iLoop = lbound(sFieldNames) to ubound(sFieldNames)
    on error resume next
    sTempString = replace(trim(ucase(sFieldNames(iLoop))),"_","")
    sNull = rs(sTempString)
    'response.write rs(iLoop).name & "<BR>"
    If err.number <> 0 Then
    'response.write "<B>" & sTempString & "</b> - " & err.description & "<BR>"
    Call ErrorOccurred(sErrorMessage002, sErrorEmailRecipientAddress, sErrorEmailRecipientName)
    End If
    on error goto 0
    Next
    rs.movenext
    Else
    '*** Without Header
    on error resume next
    connOLEDB.Open "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & sFilePath & ";Extended Properties='text;HDR=NO;FMT=Delimited'"
    If err.number <> 0 Then
    Call ErrorOccurred(sErrorMessage003, sErrorEmailRecipientAddress, sErrorEmailRecipientName)
    End If

    Select Case ucase(request("Type"))
    Case "PIC"
    sSQL = "select * from [" & sDataSourceFileName & "] where (F8 like '%PIC%' OR F8 like '%ODDS%') order by F1 asc, F7 asc, F4 asc"
    strTitle = "BOBCAT OF ST LOUIS - ODDS & ENDS FOR SALE"
    strBanner = "odds-and-ends-banner.gif"
    Case "TAKE"
    sSQL = "select * from [" & sDataSourceFileName & "] where (F8 like '%TAKE%') order by F1 asc, F7 asc, F4 asc"
    strTitle = "BOBCAT OF ST LOUIS - LAWN MOWERS FOR SALE"
    strBanner = "close-out-sale-banner.gif"
    Case Else
    sSQL = "select * from [" & sDataSourceFileName & "] where (F8 not like '%PIC%' AND F8 not like '%ODDS%' AND F8 not like '%TAKE%') order by F1 asc, F7 asc, F4 asc"
    strTitle = "BOBCAT OF ST LOUIS - USED MACHINE LIST-RETAIL"
    strBanner = "used-equipment-banner.gif"
    End Select
    Set rs = Server.CreateObject("ADODB.Recordset")
    rs.CursorLocation = 3 'adUseClient
    rs.CursorType = 3 'adOpenStatic
    rs.LockType = 4 'adLockBatchOptimistic
    rs.open sSQL,connOLEDB
    Set rs.ActiveConnection = Nothing
    'rs.Open sSQL, connOLEDB, adOpenStatic, adLockReadOnly
    End If
    %>

    <% If request("Type") = "PIC" Then %>
    <h1>Odds & Ends For Sale</h1>
    <% ElseIf request("Type") = "TAKE" Then %>
    <h1>Lawn Mowers For Sale</h1>
    <% Else %>
    <h1>Used Equipment</h1>
    <% End If %>

    <!--#include virtual="/include/StatusMessageScript.asp"-->
    <BR><span style="font: xx-small;">Last Updated: <%=sCSVFileDate%></span>

    <P>
    <b>The information on this page is subject to change without notice and availability of items is NOT guaranteed.</b>

    <P>
    <!--
    <% If request("Type") = "PIC" Then %>
    <p><a href="UsedEquipment.asp"><B>Used Equipment</b></a> for sale...</p>
    <p>A <a href="UsedEquipment.asp?Type=TAKE"><B>LAWN MOWERS FOR SALE</b></a></center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<b>(C lick To View Items)</b></p>
    <% ElseIf request("Type") = "TAKE" Then %>
    <p><a href="UsedEquipment.asp"><B>Used Equipment</b></a> for sale...</p>
    <p>Please take a look at the <a href="UsedEquipment.asp?Type=PIC"><B>Odds & Ends For Sale</b></a> and submit an offer, if desired.<BR> All offers will be considered and you will be contacted if you have issued the winning bid.</p>
    <% Else %>
    <p>Please take a look at the <a href="UsedEquipment.asp?Type=PIC"><B>Odds & Ends For Sale</b></a> and submit an offer, if desired.<BR> All offers will be considered and you will be contacted if you have issued the winning bid.</p>
    <p>A <a href="UsedEquipment.asp?Type=TAKE"><B>LAWN MOWERS FOR SALE</b></a></center>&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp ;&nbsp;&nbsp;&nbsp;&nbsp;<b>(Click To View Items)</b></p>
    </center>
    <% End If %>
    -->

    <%
    Do While not rs.eof
    on error resume next
    iBR = cint(rs(0))
    sModel = rs(1)
    If isnumeric(rs(2)) then
    sSerial = cstr(cdbl(rs(2)))
    Else
    sSerial = cstr(rs(2))
    End If
    sDescription = rs(3)
    sSellingPrice = "$" & formatnumber(rs(4),2)
    sMeter = rs(5)
    sModelYear = rs(6)
    %>
    <TABLE CELLPADDING=4 CELLSPACING=0 BGCOLOR="white" BORDER="1" width="600">
    <TR>
    <TD nowrap width="75%">
    Model:&nbsp;<%=sModel%><BR>
    Desc:&nbsp;<%=sModelYear%> - <%=sDescription%><BR>
    Meter:&nbsp;<%=sMeter%><BR>
    Serial:&nbsp;<%=sSerial%><BR>
    Location:&nbsp;<%=sBranch(iBR)%><BR><%=sBranchPhone(iBR)%><BR>
    <a href="UsedEquipmentContact.asp?Serial=<%=sSerial%>&Info=Yes" target="_blank"><b>PRINT</b></a>
    </td>
    <TD align="center">
    <%
    sImageFileName = "\_UsedEquipment\images\tn_" & cstr(sSerial) & ".jpg"
    sLocalImageFileName = server.mappath(sImageFileName)

    sImageFileNameBig = "\_UsedEquipment\images\" & cstr(sSerial) & ".jpg"
    sLocalImageFileNameBig = server.mappath(sImageFileNameBig)

    If fs.FileExists(sLocalImageFileName)=true Then
    if fs.FileExists(sLocalImageFileNameBig)=true Then
    %>
    <a href="<%=sImageFileNameBig%>" target="_blank">
    <img src="<%=sImageFileName%>" alt="<%=sDescription%>" border="0">
    </a>
    <%
    else
    %>
    <img src="<%=sImageFileName%>" alt="<%=sDescription%>" border="0">
    <%
    end if
    Elseif fs.FileExists(sLocalImageFileNameBig)=true Then
    %>
    <a href="<%=sImageFileNameBig%>" target="_blank">
    <img src="<%=sImageFileNameBig%>" alt="<%=sDescription%>" border="0" width="129" height="100">
    </a>
    <%
    Else
    End If
    %>Price:&nbsp;<%=sSellingPrice%><%
    %>
    <% If request("Type") = "PIC" Then %>
    <BR><a href="UsedEquipmentContact.asp?Serial=<%=sSerial%>">Place Bid / Request Info</a>
    <% End If %>
    </TD>
    </tr>
    </TABLE><BR>
    <%
    rs.movenext
    Loop
    %>

    <%

    '*** Close connection
    rs.close
    Set rs = Nothing
    connOLEDB.Close
    Set connOLEDB = Nothing
    Set fs = nothing
    %>

    <!--#include virtual="/include/desBottomInclude.asp"-->

    Thanks for any help in advance

Similar Threads

  1. Replies: 1
    Last Post: 06-30-2007, 01:57 AM
  2. How to use Crystal Reports from ASP?
    By Aruna in forum ASP.NET
    Replies: 2
    Last Post: 06-28-2002, 03:45 PM
  3. Replies: 1
    Last Post: 02-19-2002, 01:33 PM
  4. Replies: 2
    Last Post: 02-05-2001, 03:22 AM
  5. ASP and Crystal Reports 7
    By Brandon in forum authorevents.mitchell
    Replies: 1
    Last Post: 10-17-2000, 10:04 AM

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
HTML5 Development Center
 
 
FAQ
Latest Articles
Java
.NET
XML
Database
Enterprise
Questions? Contact us.
C++
Web Development
Wireless
Latest Tips
Open Source


   Development Centers

   -- Android Development Center
   -- Cloud Development Project Center
   -- HTML5 Development Center
   -- Windows Mobile Development Center