Vs.NET Crystal reports --changing db from sql to oracle and viceversa

starter1

New member
Joined
Jun 26, 2006
Messages
4
Programming Experience
Beginner
Hello,

Iam trying to use crystal reports in vs.net 2003. Cr is of version 9.5. My problem with CR is iam not able to change the database type from sql to oracle and oracle to sql dynamically at run time.

the report can either be designed initially with sql or oracle , at run time i will know exactly wot db i need to connect to ...and change it accordingly.

This is my code....and this looks like working only if Crystal report is oracle designed initially...and it works ....but if report was done with sql initially ...iam not able to pass oracle params (usrname,passwd etc)....may be i need to change the db type first but donno how to do.
VB.NET:
[SIZE=2][COLOR=#0000ff]Dim[/COLOR][/SIZE][SIZE=2] tlicurrent [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] CrystalDecisions.Shared.TableLogOnInfo[/SIZE]
 
[SIZE=2][SIZE=2][COLOR=#0000ff]For[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]Each[/COLOR][/SIZE][SIZE=2] tbCurrent [/SIZE][SIZE=2][COLOR=#0000ff]As[/COLOR][/SIZE][SIZE=2] CrystalDecisions.CrystalReports.Engine.Table [/SIZE][SIZE=2][COLOR=#0000ff]In[/COLOR][/SIZE][SIZE=2] crDoc.Database.Tables
tlicurrent = tbCurrent.LogOnInfo
[/SIZE][SIZE=2][COLOR=#0000ff]With[/COLOR][/SIZE][SIZE=2] tlicurrent.ConnectionInfo
.ServerName = servername
.UserID = usrname
.Password = passwd
.DatabaseName = ""
[/SIZE][SIZE=2][COLOR=#0000ff]End[/COLOR][/SIZE][SIZE=2][COLOR=#0000ff]With
[/COLOR][/SIZE][SIZE=2]tbCurrent.ApplyLogOnInfo(tlicurrent)
[/SIZE][SIZE=2][COLOR=#0000ff]Next[/COLOR][/SIZE][SIZE=2] tbCurrent[/SIZE]
also i tried using CRAXDDRT20 as found in other documents , but could not find connectionproperties on this object...

Thanks for any help

[/SIZE]
 
Last edited by a moderator:
The quick solution is to create two reports (that look identical), one with oralce and one with SQL, as soon as you know which database you are using set a variable to that value and set up an 'IF' statement to call the correct report based on that variable...

Not the best answer but it should work...and the user will never know the difference...
 
Back
Top