Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Web Reporting with Crystal Using ADOB

Status
Not open for further replies.

sounami

Programmer
Jun 8, 2001
3
US
I am developing an web application that uses crystal reports to view a specific data from a database. I am using IIS 5 Win2k, SQL2k, and Crystal 8.5. I can't seem to find any documentation on this issue. The code I have so far doesn't work. I tried tweaking the sample code provided by crystal but no luck. Here is the code I have so far. Does anyone know what I have to change or add to make it work.

Thanks you,

Sung


<%
dim servername
dim reportname
dim objRS
dim objConn


set objConn = createobject(&quot;ADODB.Connection&quot;)
objConn.connectionstring = <some string>


Set objCmd = server.CreateObject(&quot;ADODB.Command&quot;)

Set objCmd.ActiveConnection = objConn
objCmd.CommandText = &quot;SOMETABLE&quot;
objCmd.CommandType = adCmdTable


If Not IsObject (session(&quot;oApp&quot;)) Then
Set session(&quot;oApp&quot;) = Server.CreateObject(&quot;CrystalRuntime.Application&quot;)
End If

If IsObject(session(&quot;oRpt&quot;)) then
Set session(&quot;oRpt&quot;) = nothing
End if

On error resume next

Set session(&quot;oRpt&quot;) = session(&quot;oApp&quot;).NewReport

If Err.Number <> 0 Then
Response.Write &quot;Error Occurred creating Report Object: &quot; & Err.Description
Set Session(&quot;oRpt&quot;) = nothing
Set Session(&quot;oApp&quot;) = nothing
Session.Abandon
Response.End
End If


session(&quot;oRpt&quot;).MorePrintEngineErrorMessages = False
session(&quot;oRpt&quot;).EnableParameterPrompting = False

Set Database = session(&quot;oRpt&quot;).Database
Set Tables = Database.Tables

'**** I am LOST RIGHT ABOUT HERE ****'
session(&quot;oRpt&quot;).Database.AddADOCommand objConn, objCmd

'Set FirstTable = Tables.Item(1)

On Error Resume Next
session(&quot;oRpt&quot;).ReadRecords

If Err.Number <> 0 Then
Response.Write &quot;Error Occurred Reading Records: &quot; & Err.Description
Set Session(&quot;oRpt&quot;) = nothing
Set Session(&quot;oApp&quot;) = nothing
Session.Abandon
Response.End
Else
If IsObject(session(&quot;oPageEngine&quot;)) Then
set session(&quot;oPageEngine&quot;) = nothing
End If
set session(&quot;oPageEngine&quot;) = session(&quot;oRpt&quot;).PageEngine
End If
%>
<!-- #include file=&quot;SmartViewerActiveX.asp&quot; -->
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top