Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > .NET > Other .NET > Crystal Reports
Password Reminder
Register
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
Crystal Reports General discussion about Crystal Reports. For discussions specific to the book Professional Crystal Reports for VS.NET, please see the book discussion forum for that book.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Crystal Reports section of the Wrox Programmer to Programmer discussions. This is a community of tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old June 3rd, 2003, 05:33 PM
Registered User
 
Join Date: Jun 2003
Location: Vancouver, WA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dimondwoof
Default Accessing a CR from VB.NET

I'm trying to update the record source for my report from my VB.NET application. This is the code I'm using:

Public Function SetReportConnection(ByVal oRpt As ReportDocument) As ReportDocument

Try
  Dim crTableLogonInfo As CrystalDecisions.Shared.TableLogOnInfo
  Dim crConnectionInfo As CrystalDecisions.Shared.ConnectionInfo
  Dim crTable As Table
  Dim strName As String

  crTableLogonInfo = New TableLogOnInfo()
  crConnectionInfo = New ConnectionInfo()

  crConnectionInfo.ServerName = clsSQLLogin.strServerName
  crConnectionInfo.DatabaseName = clsSQLLogin.strDB
  crConnectionInfo.UserID = clsSQLLogin.strUserName
  crConnectionInfo.Password = clsSQLLogin.strPassWord
  crTableLogonInfo.ConnectionInfo = crConnectionInfo

  For Each crTable In oRpt.Database.Tables
    crTable.ApplyLogOnInfo(crTableLogonInfo)
  Next

  Try
    strName = oRpt.Database.Tables(0).Location.ToString
    oRpt.Database.Tables(0).Location = strName
  Catch ex As Exception
    MessageBox.Show(ex.Message & ex.GetType.ToString)
  Finally
    SetReportConnection = oRpt
  End Try
Catch ex As Exception
  MessageBox.Show(ex.Message & ex.GetType.ToString)
End Try
End Function

The lines regarding getting and setting the Location were given to me by Crystal Decisions help and work MOST of the time. It is apparently required to force the report to update it's record source. However, I have a report that was working great and all of a sudden, it gets to that line and just hangs. No error message, the program just stops responding. Does anyone have any better idea on how to handle this?
Reply With Quote
  #2 (permalink)  
Old June 24th, 2003, 10:27 AM
Registered User
 
Join Date: Jun 2003
Location: Vancouver, WA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via Yahoo to dimondwoof
Default

Well, come to find out it wasn't hanging. The problem was that I have the report based on A SQL stored procedure. Apparently, when you set the location of a CReport, it touches the source (or Location, as they call it) and queries it for a structure. Because the stored procedure takes so long to run when you don't pass it any parameters (which apparently you can't when setting the location), it was taking about 10 minutes to even open the report window. This is before it would re-query the source based on the filters applied.

The solution: I set a "@GetData bit = 0" parameter in the stored procedure and then when I call the report, I pass it a 1. If the variable is set to 0 in the sp, I return a recordset "SELECT * FROM tblSourceTable WHERE 1 = 0". That way it would return the structure almost instantly.
Reply With Quote
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
VB.NET - creating a CR report at run time jimbodeni Crystal Reports 4 March 21st, 2013 10:01 AM
Installation vb.net windows application with CR. saket123 .NET Framework 2.0 0 August 12th, 2008 11:44 PM
Deploy CR with Visual Studio 2005 VB.Net clflyer Crystal Reports 0 March 7th, 2007 12:41 PM
Dynamic images from VB .net to CR .net. Given Path Alita Crystal Reports 0 September 22nd, 2004 01:51 AM
CR in VB.Net Using Large Data Table seabiscuit Crystal Reports 1 July 7th, 2004 12:28 AM



All times are GMT -4. The time now is 08:38 PM.


Powered by vBulletin®
Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.