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 bkrike on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem setting ADO datasource and Unbound fields from ASP

Status
Not open for further replies.

lwatanabe

Programmer
Jul 22, 2001
13
US
I have created a report with unbound fields with the Crystal 8 RDC in VB6 (the only possible way I know how to create a report with unbound fields aside from creating a new report at runtime) and am having some problems. The report is a template that has no database set. The report has a bunch of static text objects and a few unbound fields. I want to create an ADO recordset in ASP and set it as the report data source at run-time, then bind the unbound fields to fields in my recordset.

I am completely stumped. I get an 'index out of bounds' error when calling the SetDataSource method.

Here is the general gist of what I have been doing...

Dim dbCONN
Dim rsPriceSurvey
Dim strSQL

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

If IsObject(session("oRpt")) Then
Set session("oRpt") = Nothing
End If
Set session("oRpt") = session("oApp").OpenReport("f:\ session("oRpt").MorePrintEngineErrorMessages = False
session("oRpt").EnableParameterPrompting = False

Set dbCONN = Server.CreateObject("ADODB.Connection")
dbCONN.ConnectionString = "Driver={SQL Server};" & _
"Server=Server;" & _
"Uid=Uid;" & _
"Pwd=Pwd;" & _
"Database=Database;"
dbCONN.Open

strSQL = &quot;select upc from starnet.warehouse.dbo.authorized where statuscode<3 and authorized=1 and storeid<4 and keyfield>700000&quot;

Set rsPriceSurvey = Server.CreateObject(&quot;ADODB.Recordset&quot;)
rsPriceSurvey.Open strSQL, dbCONN, 3

session(&quot;oRpt&quot;).Database.SetDataSource rsPriceSurvey, 3, 1
session(&quot;oRpt&quot;).DTLUPC.SetUnboundFieldSource &quot;{rsPriceSurvey.upc}&quot;

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

rsPriceSurvey.Close
dbCONN.Close
Set rsPriceSurvey = Nothing
Set dbConn = Nothing

I'm really dying, here, and any help would be so greatly appreciated.

Lance
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top