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 = "select upc from starnet.warehouse.dbo.authorized where statuscode<3 and authorized=1 and storeid<4 and keyfield>700000"
Set rsPriceSurvey = Server.CreateObject("ADODB.Recordset"
rsPriceSurvey.Open strSQL, dbCONN, 3
session("oRpt"
.Database.SetDataSource rsPriceSurvey, 3, 1
session("oRpt"
.DTLUPC.SetUnboundFieldSource "{rsPriceSurvey.upc}"
If IsObject(session("oPageEngine"
) Then
Set session("oPageEngine"
= Nothing
End If
Set session("oPageEngine"
= session("oRpt"
.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
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"
Set session("oApp"
End If
If IsObject(session("oRpt"
Set session("oRpt"
End If
Set session("oRpt"
session("oRpt"
Set dbCONN = Server.CreateObject("ADODB.Connection"
dbCONN.ConnectionString = "Driver={SQL Server};" & _
"Server=Server;" & _
"Uid=Uid;" & _
"Pwd=Pwd;" & _
"Database=Database;"
dbCONN.Open
strSQL = "select upc from starnet.warehouse.dbo.authorized where statuscode<3 and authorized=1 and storeid<4 and keyfield>700000"
Set rsPriceSurvey = Server.CreateObject("ADODB.Recordset"
rsPriceSurvey.Open strSQL, dbCONN, 3
session("oRpt"
session("oRpt"
If IsObject(session("oPageEngine"
Set session("oPageEngine"
End If
Set session("oPageEngine"
rsPriceSurvey.Close
dbCONN.Close
Set rsPriceSurvey = Nothing
Set dbConn = Nothing
I'm really dying, here, and any help would be so greatly appreciated.
Lance