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

Changing Server and Table using CrystalReportViewer (ePortfolio Lite)

Status
Not open for further replies.

WindUp

Programmer
Mar 6, 2003
100
US
I'm trying (desperately[hammer]) to change the Server Name and the Table Name. I'm developing in a different location than the Reports will ultimately be used in. The two lines "call zz.attributes.add..." are syntactically correct, but they don't force it to use Server "XXX" or Table "XXX" (the report still displays, which means it's using the connection data it was developed with.) By the way, changing zz.UserName (or Password) to "XXX" WILL cause it to fail, so I know that much is working.

How do I change the Server Name and table Name it's using at Run Time?

Here's what I have...
Code:
<%@ Language=VBScript CodePage=65001 ENABLESESSIONSTATE = True %>
<% '*** Turn OFF Error Handling ***
   On Error Goto 0

   Response.ExpiresAbsolute = Now() - 1

   Dim objectFactory
   Set objectFactory = CreateObject(&quot;CrystalReports.ObjectFactory.2&quot;)

   '*** Create ConnectionInfo Object and ConnectionInfos Collection ***
   Dim ConInfo, ConInfos
   Set ConInfos = ObjectFactory.CreateObject(&quot;CrystalReports.ConnectionInfos&quot;)
   Set ConInfo = ObjectFactory.CreateObject(&quot;CrystalReports.ConnectionInfo&quot;)

   '*** Add ConnectionInfo to the Collection ***
   ConInfos.Add ConInfo

   '*** Set up ConnectionInfo ***
   dim zz
   for each zz in ConInfos
      '*** These Two Line Work ***
      zz.UserName = Session(&quot;request_form_login&quot;)
      zz.Password = Session(&quot;request_form_password&quot;)

      '*** These two lines do NOT work ***
      call zz.attributes.add(&quot;Server name&quot;,&quot;XXX&quot;)
      call zz.attributes.add(&quot;Table Name&quot;,&quot;XXX&quot;)
   next

   Dim HTMLViewer
   Set HTMLViewer = objectFactory.CreateObject(&quot;CrystalReports.CrystalReportViewer&quot;)  
   HTMLViewer.DatabaseLogonInfos = ConInfos
   HTMLViewer.Name = &quot;page&quot;
   HTMLViewer.IsOwnForm = true	  
   HTMLViewer.IsOwnPage = true

   Dim theReportName
   theReportName =  Request(&quot;ReportName&quot;)
   theReportName = Request.ServerVariables(&quot;APPL_PHYSICAL_PATH&quot;) & theReportName
   
   HTMLViewer.ReportSource = theReportName
   HTMLViewer.Refresh()
   Call HTMLViewer.ProcessHttpRequest(Request, Response, Session)
Thank You
Good Luck! [thumbsup2]
WindUp
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top