Data Connectivity
 Crystal Reports Forum : Crystal Reports for Visual Studio 2005 and Newer : Data Connectivity
Message Icon Topic: vb.net 2008 and Crystal 10 logon required Post Reply Post New Topic
Author Message
dprima
Newbie
Newbie


Joined: 20 Mar 2008
Location: United States
Online Status: Offline
Posts: 1
Quote dprima Replybullet Topic: vb.net 2008 and Crystal 10 logon required
    Posted: 20 Mar 2008 at 6:05am
I have an app I'm migrating from vb.net 2003 to v2008.  I'm using the push model via SetDataSource to attach (bind) datasets from an Access database to a report at runtime.  This has been working fine in 2003 code.  Now, in v2008, I'm presented with a logon dialog box which fails no matter what I put in it.  I found some code which allows me to update the server name for the tables in the ReportDocument object (LogOnInfo.ConnectionInfo.ServerName), which I refresh by invoking the ApplyLogOnInfo method.  This gets me past the logon prompt.
 
However, now the data that shows on the report is not the data from the datasets, it's the data from the query that was used as the datasource when the report was originally designed.  This is not data that was saved with the report, as the report has no saved data.
 
I've included the code snippet with the relevant section below:
 
' mDS is a collection of DataSet objects.
' crvViewer is the Crystal Viewer control.
' gDataPath, gReportPath, mReportName are string variables.
' conDataDB is a string constant.

Dim cr As New ReportDocument
Dim i As Integer
Dim r As Integer
 
cr.Load(gReportPath & mReportName)
 
For i = 0 To cr.Database.Tables.Count - 1
   With cr.Database.Tables(i)
      .LogOnInfo.ConnectionInfo.ServerName = gDataPath & conDataDB
      .ApplyLogOnInfo(.LogOnInfo)
   End With
Next
 
cr.VerifyDatabase()
cr.Refresh()

If (Not mDS Is Nothing) Then
   cr.SetDataSource(mDS(1))
   For i = 2 To mDS.Count     '  if more than one dataset, for the report's subreports
      For r = 0 To (cr.Subreports.Count - 1)
         With cr.Subreports(r)
            If (mDS(i).Tables(0).TableName = .Database.Tables(0).Name) Then
               .SetDataSource(mDS(i))
               Exit For
            End If
         End With
      Next
   Next
End If
 
crvViewer.ReportSource = cr
 
I've tried moving the logon section (in red) to below the section binding the datasets, but it doesn't make a difference.
 
Thanks,
Dan
IP IP Logged
rodiel
Newbie
Newbie
Avatar

Joined: 02 Sep 2008
Location: Canada
Online Status: Offline
Posts: 1
Quote rodiel Replybullet Posted: 02 Sep 2008 at 2:38pm
Hey dan,
 
did you find a fix to this problem?
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.031 seconds.