Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Unable to print report

Status
Not open for further replies.

ChrisHiggins

Programmer
Jan 14, 2004
11
0
0
GB
I am converting a project from VB6 to VB.net and I am having problems with the crystal reports. The code is as follows:-

'Print the transfer report
Dim CPProperty As CRAXDDRT.ConnectionProperty
Dim DBTable As CRAXDDRT.DatabaseTable
Dim Report As New TransferReport
DBTable = Report.Database.Tables(1) '<--- This is the line that it is erroring.

'Connect to the sql server
CPProperty = DBTable.ConnectionProperties("Data Source")
CPProperty.Value = stSqlServer
'Set the database user name
CPProperty = DBTable.ConnectionProperties("User ID")
CPProperty.Value = stSqlSignon
'Set the database password
CPProperty = DBTable.ConnectionProperties("Password")
CPProperty.Value = stSqlPassword
'Connect to the required database
CPProperty = DBTable.ConnectionProperties("Initial Catalog")
CPProperty.Value = "S_P_Reporting"
'Connect to the required table or view
DBTable.Location = "Nominal_Reporting_Priarch"
'Print the report
'Report.PrintOut(False)
Report.PrintToPrinter(1, False, 1, 999)

The error I get is "system.InvalidCastException".

Can anybody tell me what I am doing wrong?

Thanks

Chris
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top