I need to be able to change the database location in Crystal 10, in vb code I have searched for solutions here
and have found one that would be just right for my problem.
I get the following error when I try to print a report on the mySQL data base which is located on the web.
Run-time error '-2147189180(80047e44)'
The table 'tblproject' could not be found.
this is the code I am using:-
Dim crx As New CRAXDDRT.Application ' creates an instance of the Crystal Report application
Dim rpt As CRAXDDRT.Report 'will hold the report object later
Dim i As Integer
Set rpt = crx.OpenReport(strReport) 'asks the crystal application to open a report file named C:\blah\CoverPage.rpt and returns it to rpt
rpt.DiscardSavedData 'throws out any saved data the report might already have
For i = 1 To rpt.Database.Tables.Count 'the database.tables collection is all the tables used by the report
------------------ The following Line Gives The Error -------------------------------------
rpt.Database.Tables.Item(i).SetTableLocation rpt.Database.Tables.Item(i).Location, "", m_objConnConnectString
'SetTableLocation sets where Crystal will look for that table. g_objcon is just an ADO connection I've already opened on my dataset
'the connectionstring could simply be specified here, e.g. "provider=SQLOLEDB;server=MySQLServer;database=MyDatabaseName;UID=MyUser;PWD=MyPassword"
'I use theg_objcon.connectionstring because in most of my apps, I have logic to choose which database the user will connect to, and once the
'connection is open, I simply use it's connection string to avoid repeating the logic to choose which database.
CrystalActiveXReportViewer1.ReportSource = rpt
Although not related Using the same code but the connect string below I have a strange problem with the same code but attempting to print a report from a local Access database for each table in the report it asks for database location ans user and password the connect string is:-
myDBConnectString = "provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & App.Path & "\Data\" & strMyDB
username and password are not required as the program generates the data