Data Connectivity
 Crystal Reports Forum : Crystal Reports .NET 2003 : Data Connectivity
Message Icon Topic: eliminate ODBC login credentials Post Reply Post New Topic
Author Message
aleplgr
Newbie
Newbie


Joined: 09 Dec 2006
Online Status: Offline
Posts: 23
Quote aleplgr Replybullet Topic: eliminate ODBC login credentials
    Posted: 18 Mar 2007 at 4:48am
Hi, I'm connecting by ODBC to a secure database, when I design the report it asks for my credentials and then I can add the tables to my report and works fine.
Now I'm running that report from a VB form asking the end user for a dates range, it works fine but before running the report the end user is prompted for credentials for every table that is used in the report.
 
I'm trying to add the Sub PrintPreview from Chapter 17 for Logging on With the Viewer Control.
So I've got the frmPreviewForm (the one that's used at the begining of  Chapter 21 for the CrystalReportViewer)
 
 and added the Sub to it for one of my tables:
 

Public Class frmPreviewForm

Inherits System.Windows.Forms.Form

Public Sub PrintPreview(ByVal UserId As String, ByVal Password As String)

Dim myReport As New CrystalReport1

Dim myLogOnInfo As CrystalDecisions.Shared.TableLogOnInfo

CrystalReportViewer1.LogOnInfo = New CrystalDecisions.Shared.TableLogOnInfos

myLogOnInfo = New CrystalDecisions.Shared.TableLogOnInfo

myLogOnInfo.TableName = "TRACTAMENTS"

With myLogOnInfo.ConnectionInfo

.UserID = UserId

.Password = Password

End With

CrystalReportViewer1.LogOnInfo.Add(myLogOnInfo)

myLogOnInfo.TableName = "TRACTAMENTS"

CrystalReportViewer1.ReportSource = myReport

End Sub

End Class

But it keeps asking for this table credentials, it seems that this PrintPreview Sub shouldn't be there...
 
 
  
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 18 Mar 2007 at 3:53pm
It looks like what you have should work fine.....Do you have subreports in this report?  If so, you also have to iterate through the subreports and set the logins there.
 
-Dell
IP IP Logged
aleplgr
Newbie
Newbie


Joined: 09 Dec 2006
Online Status: Offline
Posts: 23
Quote aleplgr Replybullet Posted: 19 Mar 2007 at 4:06am

No, I don't have subreports.. it seems like this code is never executed because I put a  MsgBox("Hellooo") and it never appears..

I put the PrintPreview Sub  right before the end of the frmPreviewForm Class, should it be there?  I have just 2 forms: the one that runs the report with the 2 dates and the button to preview it and the frmPreviewForm where is the CrystalReportViewer1 Cry
IP IP Logged
hilfy
Admin Group
Admin Group
Avatar

Joined: 20 Nov 2006
Online Status: Offline
Posts: 3701
Quote hilfy Replybullet Posted: 19 Mar 2007 at 11:22am
I got to thinking about it and I think I've found your problem.  You're creating object, but not loading the existing information into them to update the existing properties.
 
We're working from the ReportDocument object model, and not just from the CrystalReportViewer object model, so I don't have any sample code.  However, if you go to the BusinessObjects Developer Library, on the left side of the screen, click on "Crystal Reports .NET SDK", then " .NET Developer Guide and API Reference", then "Tutorials and Sample Code", then "CrystalReportViewer Object Model Tutorials", then "Logging onto a Secure SQL Server Database", you should be able to get to sample code that will get you closer than what you're doing.
Also, Brian may have some good examples for you.
 
-Dell
IP IP Logged
aleplgr
Newbie
Newbie


Joined: 09 Dec 2006
Online Status: Offline
Posts: 23
Quote aleplgr Replybullet Posted: 20 Mar 2007 at 1:19am
ok, thanks Dell
IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 0.016 seconds.