?
Solved

Problem with "Add Command" and Table Location

Posted on 2005-05-03
12
Medium Priority
?
366 Views
Last Modified: 2008-03-06
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
0
Comment
Question by:aletheia1
  • 6
  • 6
12 Comments
 

Author Comment

by:aletheia1
ID: 13926013
Spykair, GJParker... any ideas?
0
 
LVL 19

Expert Comment

by:GJParker
ID: 13926554
please post the full ASP code used to connect to the db and display the report.

Gary
0
 

Author Comment

by:aletheia1
ID: 13927040
For inttable = 1 To Session("oRpt").Database.Tables.Count
      Set CryTable = Session("oRpt").Database.Tables.Item(CInt(inttable))
      CryTable.SetLogOnInfo "myDatabase",,"myOwner","myPassword"
      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...
0
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
LVL 19

Expert Comment

by:GJParker
ID: 13927270
Why are you setting the table location ?

If it works without that line then why do you need to try and set it ?

Gary
0
 

Author Comment

by:aletheia1
ID: 13927360
Because there are different environments, as test and production... so different table owners.
0
 
LVL 19

Expert Comment

by:GJParker
ID: 13927406
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
0
 

Author Comment

by:aletheia1
ID: 13933410
Actually the whole code is this:

For inttable = 1 To Session("oRpt").Database.Tables.Count
      Set CryTable = Session("oRpt").Database.Tables.Item(CInt(inttable))
      If Request.Cookies("connection")("db") = "prod" Then
            CryTable.SetLogOnInfo "prodDB",,"myOwner1","myPassword"
            CryTable.Location = "myOwner1." + CryTable.Name
    ElseIf Request.Cookies("connection")("db") = "test" Then
            CryTable.SetLogonInfo "testDB",,"myOwner2","myPassword"
            CryTable.Location = "myOwner2." + CryTable.Name
      End If       
Next

I was suggested to do like this in this topic... please take a look:
http://www.experts-exchange.com/Databases/Crystal_Reports/Q_20903964.html
0
 
LVL 19

Expert Comment

by:GJParker
ID: 13933666
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
0
 

Author Comment

by:aletheia1
ID: 13933789
> 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/mm/yyyy')),TRUNC(TO_DATE('31/12/2999','dd/mm/yyyy'))) AND TRUNC(datarr) >= NVL(TRUNC(TO_DATE('','dd/mm/yyyy')),TRUNC(TO_DATE('01/01/1900','dd/mm/yyyy'))) GROUP BY b.codvia,b.codvis,b.datpar,b.datarr,h.lastname,g.mezzo,e.mezzo,i.description ORDER BY datpar DESC
0
 
LVL 19

Accepted Solution

by:
GJParker earned 300 total points
ID: 13933998
I am not talkin about the report itself, yes that uses tables linked in the SQL via the command object.

But the report object model itself doesn't contain any tables as such, if you were to add thi scode into the ASP Page

For i = 1 to session("oRpt").Database.Tables.Count
  Set CRTable = session("oRpt").Database.Tables.Item(cint(i))
  Response.Write cstr(CRTable.Name)
Next

then this will return 1 table object = Command

so by usinng this code

For inttable = 1 To Session("oRpt").Database.Tables.Count
     Set CryTable = Session("oRpt").Database.Tables.Item(CInt(inttable))
     CryTable.SetLogOnInfo "myDatabase",,"myOwner","myPassword"
Next

you are telling the command which database to run the SQL query against and that is sufficient for the report to run.

Gary
0
 

Author Comment

by:aletheia1
ID: 13934064
Ok, now I understand.

Sorry for my hard comprension... Crystal Report is still a mistery for me.

Thank you :-)
0
 
LVL 19

Expert Comment

by:GJParker
ID: 13934073
At least we got there in the end.

Glad i could help

Gary
0

Featured Post

Upgrade your Question Security!

Add Premium security features to your question to ensure its privacy or anonymity. Learn more about your ability to control Question Security today.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Crystal Reports: 5 Tests for Top Performance It is complete, your masterpiece report.  Not only does it meet your customer’s expectations, it blows them out the water, all they want is beautifully summarised and displayed in a myriad of ways. …
Hot fix for .Net Crystal Reports 10.2.3600.0 to fix problems with sub reports running on 64 bit operating systems ISSUE: Reports which contain subreports fail with error "Missing Parameter Value" DEPLOYMENT SERVER OS: Windows 2008 with 64 bi…
In a question here at Experts Exchange (https://www.experts-exchange.com/questions/29062564/Adobe-acrobat-reader-DC.html), a member asked how to create a signature in Adobe Acrobat Reader DC (the free Reader product, not the paid, full Acrobat produ…
Look below the covers at a subform control , and the form that is inside it. Explore properties and see how easy it is to aggregate, get statistics, and synchronize results for your data. A Microsoft Access subform is used to show relevant calcul…
Suggested Courses
Course of the Month17 days, 2 hours left to enroll

864 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question