Click to See Complete Forum and Search --> : crystal report 6 Urgent!!!!


Nparag
December 29th, 1999, 06:30 AM
Hi guys
I am working on crystal report 6. i was using ms access as backend and connecting through a DSN. Now i have changed the backend to oracle. and i have changed the DSN in the crystal report to the new DSN. In preview mode i am able to see the report. but when i am calling the report from VB it is giving me a strange error
"Can not find SQl server"
Can anybody solve my problem

Thanx in advance

ufo
December 29th, 1999, 06:52 AM
Of course, You need to change logon property to server at runtime. Preview inside CrystalReport using his own connect so you can see report properly. See SetLogOnInfo method of CrystalReport object to set your ORACLE logon information. See code shipet for CR70 but may be functional for CR60.

I hope this help you.


Dim db as CRPEAuto.Database
Dim dbtables as CRPEAuto.DatabaseTables
Dim dbTable as CRPEAuto.DatabaseTable
Dim dbSection as CRPEAuto.Section
Dim objSubReport as Object
Dim i as Integer


set db = objReport.Database
set dbtables = db.Tables
'find the alias name of the first table in the database
If dbtables.Count >= 1 then
set dbTable = dbtables.Item(1)
dbTable.SetLogOnInfo "servername", "database", "sa", ""
for i = 1 to dbtables.Count
set dbTable = dbtables.Item(i)
dbTable.Location = dbTable.Name
next
End If




don't forget do it for subreports if exist




[ufo]

December 30th, 1999, 12:38 AM
At design time, you would have logged into the Oracle Server when launching the report. When connecting from VB, you would have to specify the connect string in the connect property of the Crystal Report Control or before invoking the
Action method in the VB Code,
set the connect string, Your code should be something like this:


CRep1.Connect = "UID=scott;PWD=Tiger;DSN=TestDB"
CRep1.Action = 1



Replace Scott/Tiger and Test DB with the respective Oracle User Id/Password and DSN Name.

Happy New Millineum