Posted by a ceTe Software moderator
Hello,
Yes, you can dynamically set the desired connection string and query using version 7 DynamicPDF ReportWriter for COM/ActiveX product. You will need to dynamically access the Query using its ID. Then you can use OpeningRecordSet event of the Query object to change the connection string and the query. Please refer to the documentation on
event driven queries
here. Also below is the code sample.
<!-- METADATA TYPE="typelib" UUID="{DF9225FE-94A4-490d-8CAD-E8366CE621D3}"-->
<%
Dim MyDocument
Set MyDocument = Server.CreateObject( "DynamicPDF.Document" )
Dim MyDocumentLayout
Set MyDocumentLayout = Server.CreateObject( "DynamicPDF.DocumentLayout")
MyDocumentLayout.LoadDplx ("D:\Temp\Document1.dplx")
Dim Qry
Set Qry = MyDocumentLayout.GetQueryById("Query1")
Dim OpenRecSet
Set OpenRecSet = GetRef("Query_OpeningRecordSet")
Qry.OpeningRecordSet OpenRecSet
Set MyDocument = MyDocumentLayout.Run
MyDocument.DrawToWeb
Private Function Query_OpeningRecordSet(e)
Dim MyRecordSet
Set MyRecordSet = Server.CreateObject("ADODB.Recordset")
Dim SqlConn
Set SqlConn = Server.CreateObject("ADODB.Connection")
Dim SqlCmd
Set SqlCmd = Server.CreateObject("ADODB.Command")
SqlConn.ConnectionString ="Correct and valid valid connection string"
SqlConn.Open
SqlCmd.ActiveConnection = SqlConn
SqlCmd.CommandText = "Select * from Products"
MyRecordSet.Open SqlCmd , , adOpenStatic
e.AddRecordSet(MyRecordSet)
End Function
%>
Thanks,
ceTe Software Support Team.