aletheia1
asked on
Problem with "Add Command" and Table Location
Hi again,
I created a report, and specified my own query with the option "Add Command".
Everything seems to work within Crystal Report.
But when I try to load my report from the ASP application, I get the error "Error Occurred Reading Records: The table 'myOwner.Command' could not be found."
Because in my ASP page I need to specify:
Table.Location = "myOwner." + Table.Name
How can I avoid this problem? I mean, how can I specify the table location in another way?
Thanks in advance
I created a report, and specified my own query with the option "Add Command".
Everything seems to work within Crystal Report.
But when I try to load my report from the ASP application, I get the error "Error Occurred Reading Records: The table 'myOwner.Command' could not be found."
Because in my ASP page I need to specify:
Table.Location = "myOwner." + Table.Name
How can I avoid this problem? I mean, how can I specify the table location in another way?
Thanks in advance
please post the full ASP code used to connect to the db and display the report.
Gary
Gary
ASKER
For inttable = 1 To Session("oRpt").Database.T ables.Coun t
Set CryTable = Session("oRpt").Database.T ables.Item (CInt(intt able))
CryTable.SetLogOnInfo "myDatabase",,"myOwner","m yPassword"
CryTable.Location = "myOwner." + CryTable.Name
Next
I get the error at the last line... because Crystal Report search for "myOwner.Command", that doesn't exist.
If I comment that line, it works... but I need to specify the table location...
Set CryTable = Session("oRpt").Database.T
CryTable.SetLogOnInfo "myDatabase",,"myOwner","m
CryTable.Location = "myOwner." + CryTable.Name
Next
I get the error at the last line... because Crystal Report search for "myOwner.Command", that doesn't exist.
If I comment that line, it works... but I need to specify the table location...
Why are you setting the table location ?
If it works without that line then why do you need to try and set it ?
Gary
If it works without that line then why do you need to try and set it ?
Gary
ASKER
Because there are different environments, as test and production... so different table owners.
Yes I understand that but seeing as you control the SQL in the Command you don't need to specify the owner in the command and subsequently it's not needed in the ASP Code.
Gary
Gary
ASKER
Actually the whole code is this:
For inttable = 1 To Session("oRpt").Database.T ables.Coun t
Set CryTable = Session("oRpt").Database.T ables.Item (CInt(intt able))
If Request.Cookies("connectio n")("db") = "prod" Then
CryTable.SetLogOnInfo "prodDB",,"myOwner1","myPa ssword"
CryTable.Location = "myOwner1." + CryTable.Name
ElseIf Request.Cookies("connectio n")("db") = "test" Then
CryTable.SetLogonInfo "testDB",,"myOwner2","myPa ssword"
CryTable.Location = "myOwner2." + CryTable.Name
End If
Next
I was suggested to do like this in this topic... please take a look:
https://www.experts-exchange.com/questions/20903964/Change-datasource.html
For inttable = 1 To Session("oRpt").Database.T
Set CryTable = Session("oRpt").Database.T
If Request.Cookies("connectio
CryTable.SetLogOnInfo "prodDB",,"myOwner1","myPa
CryTable.Location = "myOwner1." + CryTable.Name
ElseIf Request.Cookies("connectio
CryTable.SetLogonInfo "testDB",,"myOwner2","myPa
CryTable.Location = "myOwner2." + CryTable.Name
End If
Next
I was suggested to do like this in this topic... please take a look:
https://www.experts-exchange.com/questions/20903964/Change-datasource.html
Yes that's the correct way to change the database for reports that ar ecreated using tables and joins. But as this report doesn't use tables you shouldn't need to do that.
Gary
Gary
ASKER
> But as this report doesn't use tables
I don't understand this... why you say that I don't use tables?
I'm also using joins.
SELECT b.codvia, b.codvis, b.datpar, b.datarr, h.lastname AS DIPEND, e.mezzo AS departure, i.mezzo AS arrival, g.mezzo AS mezzo FROM vtab040 a, vtab032 b, vtab014 e, vtab015 f, vtab016 g, tab001 h, vtab014 i WHERE a.codvia = b.codvia AND (a.CODDIP = h.ID AND a.codogg = 1) AND f.mezzo=g.id AND f.codvia = b.codvia AND f.codvia = a.codvia AND e.id(+) = b.departure AND i.id(+) = b.arrival AND TRUNC(datpar) <= NVL(TRUNC(TO_DATE('','dd/m m/yyyy')), TRUNC(TO_D ATE('31/12 /2999','dd /mm/yyyy') )) AND TRUNC(datarr) >= NVL(TRUNC(TO_DATE('','dd/m m/yyyy')), TRUNC(TO_D ATE('01/01 /1900','dd /mm/yyyy') )) GROUP BY b.codvia,b.codvis,b.datpar ,b.datarr, h.lastname ,g.mezzo,e .mezzo,i.d escription ORDER BY datpar DESC
I don't understand this... why you say that I don't use tables?
I'm also using joins.
SELECT b.codvia, b.codvis, b.datpar, b.datarr, h.lastname AS DIPEND, e.mezzo AS departure, i.mezzo AS arrival, g.mezzo AS mezzo FROM vtab040 a, vtab032 b, vtab014 e, vtab015 f, vtab016 g, tab001 h, vtab014 i WHERE a.codvia = b.codvia AND (a.CODDIP = h.ID AND a.codogg = 1) AND f.mezzo=g.id AND f.codvia = b.codvia AND f.codvia = a.codvia AND e.id(+) = b.departure AND i.id(+) = b.arrival AND TRUNC(datpar) <= NVL(TRUNC(TO_DATE('','dd/m
ASKER CERTIFIED SOLUTION
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
ASKER
Ok, now I understand.
Sorry for my hard comprension... Crystal Report is still a mistery for me.
Thank you :-)
Sorry for my hard comprension... Crystal Report is still a mistery for me.
Thank you :-)
At least we got there in the end.
Glad i could help
Gary
Glad i could help
Gary
ASKER