Jump to content
Xtreme .Net Talk

Recommended Posts

Posted

I have a report embedded in my application. I can view it within my application at runtime using these two lines here:

CrystalReportViewer1.LogOnInfo(0).ConnectionInfo.Password = Chr(10) + "mypassword"
CrystalReportViewer1.SelectionFormula = "({OrderHistory.OrderNumber}=""" & ListView5.SelectedItems(0).Text & """)"

 

I do not have a username/password for my database file, its just a database level password. The rest of my application uses it just fine. I can open my crystal report just fine. However. I need to be able to automate the export to pdf option. ( yes i know its available on the view window but i need to be able to build a pdf and email it in the background)

 

im trying to do it with the following code

 

Report.SetDatabaseLogon("", "mypassword")
Report.RecordSelectionFormula = "({OrderHistory.OrderNumber}=""" & ListView5.SelectedItems(0).Text & """)"
Report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, "test.pdf")

 

have tried this too

 

Report.Database.Tables("OrderHistory").LogOnInfo.ConnectionInfo.Password = Chr(10) + "mypassword" 
          Report.Database.Tables("OrderHistoryList").LogOnInfo.ConnectionInfo.Password = Chr(10) + "mypassword"

 

I'm stuck. I can not pass the password correctly using the above methods. I have read so much and tried so many different examples, but they were all for workgroup accounts and not a database level pw. please help....

Posted

Solved...

 

       Dim crLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
       crLogonInfo = Report.Database.Tables(0).LogOnInfo
       crLogonInfo.ConnectionInfo.Password = Chr(10) + "mypasword"
       Report.Database.Tables(0).ApplyLogOnInfo(crLogonInfo)

       Try
           Report.RecordSelectionFormula = "({OrderHistory.OrderNumber}=""" & ListView5.SelectedItems(0).Text & """)"
           Report.ExportToDisk(CrystalDecisions.Shared.ExportFormatType.PortableDocFormat, saveFile.FileName)
       Catch ex As Exception
           MsgBox(ex.ToString)
       End Try

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...