Thursday, February 9, 2012

About Crystal Report 9

hi everybody,
I am using VB6 and CrystalReport9. so how can i call a report
from my VB form? please tell me as soon as possible with example.
bye
bappyCheck developer documentation of Crystal. They have given pretty good examples. Look for CrystalDevHelp file.

Thanks|||hi,

Thanks for your replay. but i want Crystal Report Control OCX that have in Crystal 8.5. This control is easy to use for me. so please tell me have any option to use that OCX? or i have to use crystal report viewer control please let me clear about that.

bye

thanks again

bappy|||What if you use Crystal Report Viewer Control? I am not sure whether it's a OCX or OLE ? but what if you use this control (viewer) ? Does it involve lots of code change because version 10 uses Crystal Viewer control Extensively. So you should be prepared for that migration also in future.

Thanks|||I have come across this just now :

Retired Developer APIs

Crystal Reports ActiveX Control (crystl32.ocx)
The Crystal Reports ActiveX control is no longer supported and no longer available as of Crystal Reports version 9.

Thanks|||hi dilemma,
thanks for your replay. now i am trying to use viewer control.

bye

bappy|||Best of Luck , let me know if you find any problem.

Thanks|||Hi dilemma,

Thanks for your replay. Actually now I am using Oracle9i and Crystal 9. but here is a problem. I can build a report by using Crystal 9 in VB Project but when I am trying to show report form then an error generate the message is Login failed. I know that I have to pass user name, password, TNS name at runtime but I dont know about syntax. So can you tell me about that syntax or send me an example?

Please help me as soon as possible

Thanks for supporting me.

Bappy|||You need to code something like this.

How to connect to an OLEDB data source
This example demonstrates how to connect to an OLEDB (ADO) data source, change the data source, and change the database by using the ConnectionProperty Object, as well as how to change the table name by using the Location property of the DatabaseTable Object,. CrystalReport1 is created using an ODBC data source connected to the pubs database on Microsoft SQL Server. The report is based off the authors table.

' Create a new instance of the report.
Dim Report As New CrystalReport1

Private Sub Form_Load()
' Declare a ConnectionProperty object.
Dim CPProperty As CRAXDRT.ConnectionProperty
' Declare a DatabaseTable object.
Dim DBTable As CRAXDRT.DatabaseTable

' Get the first table in the report.
Set DBTable = Report.Database.Tables(1)

' Get the "Data Source" property from the
' ConnectionProperties collection.
Set CPProperty = DBTable.ConnectionProperties("Data Source")

' Set the new data source (server name).
' Note: You do not need to set this property if
' you are using the same data source.
CPProperty.Value = "Server2"

' Get the "User ID" property from the
' ConnectionProperties collection.
Set CPProperty = DBTable.ConnectionProperties("User ID")

' Set the user name.
' Note: You do not need to set this property if
' you are using the same user name.
CPProperty.Value = "UserName"

' Get the "Password" property from the
' ConnectionProperties collection.
Set CPProperty = DBTable.ConnectionProperties("Password")

' Set the password.
' Note: You must always set the password if one is
' required.
CPProperty.Value = "Password"

' Get the "Initial Catalog" (database name) property from the
' ConnectionProperties collection.
' Note: You do not need to set this property if
' you are using the same database.
Set CPProperty = DBTable.ConnectionProperties("Initial Catalog")

' Set the new database name.
CPProperty.Value = "master"

' Set the new table name.
DBTable.Location = "authors2"

Screen.MousePointer = vbHourglass
' Set the report source of the viewer and view the report.
CRViewer91.ReportSource = Report
CRViewer91.ViewReport
Screen.MousePointer = vbDefault
End Sub

Thanks

No comments:

Post a Comment