Fail to create SQL query report because of ORA-00923
Hi expert,
I would like to SQL query report using the following query:
select min(identified_date) first_identified,
max(actual_COMPLETE) last_closed,
count(id) total_issues,
sum(decode(status,'Open',1,0)) open_issues,
sum(decode(status,'Pending',1,0)) pending_issues,
sum(decode(status,'Resolved',1,0)) closed_issues,
sum(decode(status,'Will Not Resolve',1,0)) not_resolve_issues,
sum(decode(status,
'Open',decode(priority,null,1,0),
0)) open_no_prior,
sum(decode(status,
'Open',decode(priority,1,1,0),
0)) open_prior_1,
sum(decode(status,
'Open',decode(priority,'2',1,0),
0)) open_prior_2
sum(decode(status,
'Open',decode(priority,3,1,0),
0)) open_prior_3,
sum(decode(status,
'Open',decode(priority,'4',1,0),
0)) open_prior_4,
sum(decode(status,
'Open',decode(priority,5,1,0),
0)) open_prior_5
from SOFTPROJ_issues
where project_id = :P83_PROJECT
However, I got the following error during the steps of creation:
1 error has occurred
Query cannot be parsed, please check the syntax of your query. (ORA-00923: FROM¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿)
I wonder why if it is getting the error because I could create the report with the following query without problems:
select min(identified_date) first_identified,
max(actual_COMPLETE) last_closed,
count(id) total_issues,
sum(decode(status,'Open',1,0)) open_issues,
sum(decode(status,'Pending',1,0)) pending_issues,
sum(decode(status,'Resolved',1,0)) closed_issues,
sum(decode(status,'Will Not Resolve',1,0)) not_resolve_issues,
sum(decode(status,
'Open',decode(priority,null,1,0),
0)) open_no_prior,
sum(decode(status,
'Open',decode(priority,1,1,0),
0)) open_prior_1,
sum(decode(status,
'Open',decode(priority,3,1,0),
0)) open_prior_3,
sum(decode(status,
'Open',decode(priority,5,1,0),
0)) open_prior_5
from SOFTPROJ_issues
where project_id = :P83_PROJECT
1 error has occurred
Query cannot be parsed, please check the syntax of your query. (ORA-00923: FROM¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿¿)
The difference is to add the followings only:
sum(decode(status,
'Open',decode(priority,'2',1,0),
0)) open_prior_2
sum(decode(status,
'Open',decode(priority,'4',1,0),
0)) open_prior_4,
Does anyone have any idea to resolve the issue?
Thanks in advance,
Rui
By putting a comma after open_prior_2:
sum(decode(status,
'Open',decode(priority,'2',1,0),
0)) open_prior_2,Sima
Similar Messages
-
Classic Report CSV output failed to parse SQL query
Hi,
I'm trying to get a CSV output from a classic report. I'm generating the report based on a PL/SQL block that will return an SQL query. But when i download the CSV excel just gives me a:
failed to parse SQL query:
ORA-00936: Missing expression
and shows me the query that the application is trying to parse. I'm also using bind variables (page items) in the PL/SQL block that is returning me the SQL query. I think that the reason that it fails to parse the query is that the query that is shown in excel has no bind variable values.
Anyone got any ideas?Hi Arif,
run your page in debug mode and check out the SQL statement which is actually executed for the report. That might help to diagnose what is going wrong.
If you wish you can also post the report SQL statement which is getting executed.
Regards
Patrick
My Blog: http://www.inside-oracle-apex.com
APEX Plug-Ins: http://apex.oracle.com/plugins
Twitter: http://www.twitter.com/patrickwolf -
Report failed to parse SQL query:ORA-01745: invalid host/bind variable name
Hi,
We are currently upgrading from v2.2.0.00.32 to v4.0.0.00.46.
I have copied the applications onto our test server along with the various database objects and data etc.
When I am running a report in v4, it is failing with the following error: "failed to parse SQL query: ORA-01745: invalid host/bind variable name".
When I copy the SQL that builds the report into TOAD (on out test server) it runs OK so really cant see why it would fail in APEX. It works fine when I run the query in our APEX v2 and in TOAD in our live server.
The query is as follows:
SELECT
aea.ALTERATION_ID
,aea.ALTERATION_ID "ALTERATION_ID_DISPLAY"
,aea.assembly_name "Revised BOM"
,assembly.description "Revised BOM Description"
,assembly.INVENTORY_ITEM_STATUS_CODE "Revised BOM Status"
,aea.BEFORE_CHANGE_QTY
,flv.MEANING "Alteration Type"
,aea.component_name "Part No"
,component.description "Part No Description"
,component.INVENTORY_ITEM_STATUS_CODE "Part No Status"
,aea.AFTER_CHANGE_QTY
,TO_CHAR(aea.last_update_date,'DD-MM-YYYY HH24:MI:SS')"Last Update Date"
,aea.LAST_UPDATE_BY
,aea.COMMENTS
,aea.ORACLE_CHANGE_NOTICE
,AEA.SELECTION_CRITERIA
FROM XXMEL_APEX_ECO_ALTERATIONS aea
, fnd_lookup_values flv
, (SELECT INVENTORY_ITEM_STATUS_CODE
,segment1
,description
FROM mtl_system_items_b
WHERE 1=1
AND organization_id = 26) component
, (SELECT INVENTORY_ITEM_STATUS_CODE
,segment1
,description
FROM mtl_system_items_b
WHERE 1=1
AND organization_id = 26) assembly
WHERE 1=1
AND aea.COMPONENT_NAME = component.segment1 (+)
AND aea.assembly_NAME = assembly.segment1 (+)
AND flv.lookup_code = aea.acd_type
AND aea.eco = :P13_ECO
AND flv.lookup_type = 'ECG_ACTION'
AND modify_flag = 'Y'
ANy help would be great,
Thanks
Chris
Edited by: Cashy on 22-Nov-2010 04:13
Edited by: Cashy on 22-Nov-2010 04:14For some reason, the updatable fields (this is a updateable report) where not connecting to the database properly. Whn I changed them to a report columns and removed the database field reference, the report rendered
-
Fail to parse SQL query after report attributes changes on sample app
This errors occurs in the sample application istalled in Workspace PMW on the http://htmldb.oracle.com web site. Goto home page, edit Page 1, Select "Top Orders" in Region, select report attributes, change max count from 5 to 5 in "Layout and Pagination", apply changes, run page and parse SQL error occurs. Select "debug" and the following is shown regarding the query.
0.10: query could not be parsed:
SELECT a.ORDER_ID, a.ORDER_TIMESTAMP, a.CUSTOMER_ID,
b.cust_last_name || ', ' || b.cust_first_name cust_name, NVL(a.ORDER_TOTAL, 0)
FROM demo_orders a, DEMO_CUSTOMERS b
WHERE a.customer_id = b.customer_id
ORDER BY NVL(a.ORDER_TOTAL, 0) DESC order by 5 desc,5 desc
failed to parse SQL query:
ORA-00933: SQL command not properly ended
I can't see that I'm doing anything wrong but maybe someone can shed some light on this!
Thanksthis is sort of an oversight on our part. what's going on is that the sample app installs with that order by clause in the query. at the same time, the report attributes page for that region has a default sort sequence value of "1 desc" (even though column heading sorting isn't enabled). when you go to that page and try to apply any change, htmldb tries to set things up correctly for you...and you end up with that double order by. the best way to avoid the issue is to remove the order by clause from the query on the Region Definition page.
hope this helps,
raj -
SQL Query report region that only queries on first load
Hello all,
Is there any way in which you can prevent a SQL Query report region from quering data after every refresh?
I would like to make a report that queries on the first load, but then I would like to change the individual values, and reload to show the change, but every time I reload the page the columns are queried and the original values are displayed once again...
any ideas?
-MuxChet,
I created a header process to create the HTMLDB_COLLECTION. It is something like:
HTMLDB_COLLECTION.CREATE_COLLECTION_FROM_QUERY(
p_collection_name => 'Course_Data',
p_query => 'SELECT DISTINCT COURSE_ID, HTMLDB_ITEM.CHECKBOX(14,COURSE_ID) as "checker", TITLE, SUBJECT, COURSE_NUMB, SECTION, ENROLLED, null as "temp_term", null as "temp_title", null as "temp_crse_id", null as "temp_subj", null as "temp_crse_numb", null as "temp_sect", FROM DB_TBL_A, DB_TBL_B, DB_TBL_C, DB_TBL_D, DB_TBL_E, DB_TBL_F WHERE ...');
The names were changed, for obvious reasons.
I then created an SQL Report Region to see if it would work. The SQL is:
SELECT c001, c002, c003
FROM htmldb_collections
WHERE collection_name = 'COURSE_DATA'
When I run the page it says:
ORA-20104: create_collection_from_query Error:ORA-20104: create_collection_from_query ExecErr:ORA-01008: not all variables bound
Any idea why this is happening?
I'm new to HTMLDB_COLLECTIONS, so I may be doing something wrong
-Mux -
Error running a query and creating a query report.
Hi all
I have a problem with a query when I'm running it or trying to create a report for it.
23/09/2009 11:47:31: 1). [Microsoft][SQL Native Client][SQL Server]Arithmetic overflow error converting expression to data type datetime.
'Document' (RDOC) -- Run query
23/09/2009 11:01:58: 1). [Microsoft][SQL Native Client][SQL Server]Invalid object name 'CSHS.T0'.
2). [Microsoft][SQL Native Client][SQL Server]Statement 'Received Alerts' (OAIB) (s) could not be prepared. - create a query report
This happened on a Windows Server 2003 OS , when I ran the same query on local pc on xp it ran fine on both scenarios.
Please help
Bongani Dlaminiselect SlpName, ItmsGrpNam, sum(LineTotal) as 'Total Sales Minus Returns'
from
SELECT T4.SlpName, T3.ItmsGrpNam, T0.LineTotal FROM dbo.INV1 T0 INNER JOIN dbo.OINV T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod INNER JOIN OSLP T4 ON T0.SlpCode = T4.SlpCode WHERE T1.DocDate >=[%0] and T1.DoCdate<=[%1]
UNION
SELECT T4.SlpName, T3.ItmsGrpNam, (T0.LineTotal * -1) AS 'LineTotal'
FROM dbo.RIN1 T0 INNER JOIN dbo.ORIN T1 ON T0.DocEntry = T1.DocEntry INNER JOIN OITM T2 ON T0.ItemCode = T2.ItemCode INNER JOIN OITB T3 ON T2.ItmsGrpCod = T3.ItmsGrpCod INNER JOIN OSLP T4 ON T0.SlpCode = T4.SlpCode WHERE T1.DocDate >=[%0] and T1.DoCdate<=[%1 ]
) InvoicesMinusReturnsDerivedTable
group by slpname, ItmsGrpNam -
Failed to parse SQL query: ORA-01403: no data found
I'm going to post and answer my own question in the hope that others will not have to struggle with this error.
Using a report of the type PL/SQL Function Body Returning SQL and using generic columns you may run into this error
failed to parse SQL query:
ORA-01403: no data found
The SQL will run stand alone but the report fails.
There is a setting just below the source you should check:
"Maximum number of generic report columns"
In my case the number of columns was dynamic and when it exceeded the number set as the maximium number of generic columns I received the 1403 error.
Hope this helps someone.
GregThanks for much for the pointer. For anyone else struggling with this too, I found that my generic columns had unordered themselves. Reordering them solved the problem for me.
Edited by: user11096971 on Jul 22, 2010 3:19 AM -
ORA-06502 on 'SQL query' report with sort in 'Report Attributes'
Hi All,
We get the next error if we set sorting on a column in a 'Report' based on a 'SQL query'. Removing the sort, error disappeares:
failed to parse SQL query:
ORA-06502: PL/SQL: numeric or value error: NULL index table key value
Any suggestions?
ErikErik,
Thanks, this explains it. By specifying the request as part of your URL you run into the recently uncovered issue. The request you're setting is REMFROMLIST and ADD2LIST. You probably either have links that include those requests or you have branches where you specify them. Either way, in order to get reports sorting to work, you'll have to make sure that the request strings are not part of your URL. This is a work-around and the upcoming HTML DB patch release will solve this issue.
One way of avoiding this is to have computations on the previous pages that set a napplication level or page level item to the REMFROMLIST and ADD2LIST values and then you can use those items for your conditions that are currently evaluating those strings.
Hope this helps and sorry for the inconvenience,
Marc -
Creating sql query using 3 tables
There is database (supposed to be relational but it is not) and
I cannot change the tables and it is very difficult to create SQL query.
Please, help!
First table T1
a1 char 20
time timestamp
a2 char 7 (the same as t2.a2 when is trimmed)
a3 number 5,0
a4 number 8,4
a5 number 7,3
Second table T2
a2 char 15
b1 number 1,0
b2 char 1,0
b3 char 4
a3 number 5,0
Third table T3
b3 char 4
c1 char 4
c2 number 7,3
c3 number 8,4
So, I need to create query (is it possible at all!?) from those 3 tables (a1, a2, b1,b2,b3, a4, a5, c2,c3
where time is within interval (from, to), a3 in interval (1,2,3,4), t2.b3=t3.b3, t1.a2=t2.a2
group by or sorted by a1, then, a2.
Any suggestion is welcome!
Thanks!
By the way, I will use this query in Crystal Reports.As I already mentioned, I received another conditions for the query, and when I create a new one, I
First table T1
a1 number 5,0
a2 char 7 (the same as t2.a2 when is trimmed)
a3 number 8,4
a4 number 7,3
a_time timestamp
Second table T2
a2 char 15
b1 number 1,0
b2 char 1,0
b3 char 4
b4 char 4
Third table T3
c1 char 4
c2 number 7,3
c3 number 8,4
b3 char 4
where if c1='MIN' c2, c3 return min values,
and if c1='MAX' c2,c3 return max values
SQL query:
select t1.a1, t1.a2, t2.b1, t2.b2, t2.b3, t1.a3, t1.a4, t3.c1,
t3.c2, t3.c3, t2.b4
from t1, t2, t3
where (TRIM(t1.a2)=TRIM(t2.a2)
and t1.a1=19
and ((to_char(t1.a_time, 'YYYY-MM-DD') >= '2006-03-15')
and (to_char(t1.a_time, 'YYYY-MM-DD') <= '2006-03-16')))
and t3.b3=t2.b3)
order by t1.a_time
Result set:
a1, a2, b1, b2, b3, a3, a4, c1('MAX'), c2', c3', b4
a1, a2, b1, b2, b3, a3, a4, c1('MIN'), c2", c3", b4
So when I executed SQL query it returns 2 rows for the same a2.
I want to get 1 row for each a2 together with c3 (c4) min and c3 (c4) max values.
How to name columns for c2 min and c2 max (the same for c3) in order to retreive 1 row per a2 value, something like this:
a1, a2, b1, b2, b3, a3, a4, c2min, c2max, c3min, c3max, b4
Thanks -
Failed to parse SQL query by one user
Hi all,
in my app i have a text-item with a submit button. In this item i type a name and a report after the item-region show me the result(s). this works for all my users (>2000) perfectly, but one of this users become an error in the report-region:
failed to parse SQL query:
ORA-01403: no data found
We try this with the same searchstring on the same computer/browser. If i logged in the result is ok, if the user logged in, the error message shows. If i try this on the computer from the user with me logged in, result ok. If the user try this on an other pc, results error.
I have an productive and a developer workspace. In the developer workspace the user can try this perfectly without errors. Only in the productive workspace the error shows.
The SQL-Select in the reprirt ist verry simple:
select id
, name
, raum
from table
where instr(upper(name), upper(:P60_SEARCH))>0
However all users can use this search-field with report perfectly, only this one user has the error. It is no restrictions on this item or report.
Can anybody help me?Carsten,
user preferences do not have anything to do with the fact where the user resides (apex built in, LDAP, whatever). User Preferences are saved for a named user and they are loaded next time the same user loggs in. For example, if you sort your report on a column x, apex will save this as a setting and next time you call the same report, this report will be sorted the same way. Since you don't have a permission to edit services, you should check your adminstrative permissions and conntact the real administrator of the workspace to do that "purge prefference" for you. I could bet this is the reason you are getting that strange error message.
Denes Kubicek
http://deneskubicek.blogspot.com/
http://www.opal-consulting.de/training
http://apex.oracle.com/pls/otn/f?p=31517:1
------------------------------------------------------------------------------ -
Chart Query and Failed to parse SQL query
Hi,
first of all, this is not a question. It is a reminder for me and maybe for someone with the same problem.
I just fell over this for the 123124 time.
I have a 3D Chart Query
select sum(order_ok) value,
count(*) maximum_value
from v_dialer_campaign
where campaign_uuid = :P300_CAMPAIGN_IDSaving fails with
"1 error has occurred Failed to parse SQL query!" ...
Saving the query without validation works, but does not show any result in the chart.
v_dialer_campaign is a view selecting from a view in a mssql db over database link and HS.
running the select in sqlplus or toad works.
Without any trace on freetds/unixodb/hs side, i would have not found the following line:
[FreeTDS][SQL Server]The data types nvarchar and text are incompatible in the equal to operator.[FreeTDS][SQL Server]Statement(s) could not be prepared.
Solution:
with q as (select :P300_CAMPAIGN_ID val from dual)
select sum(order_ok) value,
count(*) maximum_value
from v_dialer_campaign
where campaign_uuid in ( select val from q)Maybe the error output when validating the query should be included in the APEX error message.
Same solution applies for dynamic LOV's reading from HS using a where clause.I tried your first query on Apex 3.2 and it created a nice dial chart.
Is there any ORA-xxxxx error along with the "failed to parse SQL query" message? Did you double check column & table name spelling?
P.S. The second query is invalid (a superfluous comma after the second column). -
Column sort gives "failed to parse SQL query"
Hi folks,
I have a page with a chart and 5 reports. All report columns are sortable.
When I first navigate to the page from a menu, the chart and all reports display correctly. Given certain query criteria, reports 2 and 4 correctly return no data, and show my polite 'no data found' message.
If I sort report 1 or 3 or 5 by clicking a column heading, the chart and reports 1, 3 and 5 display correctly, but in report regions 2 and 4 I then get
failed to parse SQL query:
ORA-06502: PL/SQL: numeric or value error: NULL index table key valueThese errors can be cleared by navigating to the page again from a menu.
What's wrong? How can I fix it?
I'm at 1.6.0.00.87, db 10.1.0.3.0.
All ideas gratefully received.
Thanks
John DOK, I now have a workspace.
I recreated the problem using page 1 of the Sample Application (app 15027).
1 - Copy region "My Top Orders" to "My Top Orders 2" on page 1 (same display point, column 2).
2 - Edit the SQL of "My Top Orders 2" to remove the ORDER BY clause.
3 - Edit the columns of "My Top Orders 2" to make all columns other than ORDER_ID sortable.
4 - Copy region "My Top Orders 2" to "My Top Orders 3" on page 1 (same display point, column 2)..
5 - Run page 1
6 - Click a column heading on "My Top Orders 2" and I got "failed to parse..." on "My Top Orders 3".
BUT it's intermittent. Navigate away from page 1 then return, and you may find the error doesn't recur.
So, what's up Doc?
Many thanks,
John -
Setting a Default Value in SQL Query Report
Hello:
We are using a SQL Query Report to provide a mass update to a table. We are using the apex.collection and having it display a number of records in a SQL Query Report for mass update. We have 14 columns in the report, for which the first 11 are populated via the collection. The remaining 3 are open for input but the individual making the updates. We've were able to provide a default value for 2 of the remaining 3 columns using a named LOV's - however the fourth column we would like to default a sysdate - but we are not successful.
We've attempted many things but none seem to work, including adding that column to the collection and assigning it a default sysdate value. We've also tried changing the settings in the report attributes --> Tabular Form Elements by setting the Display as to: Datepicker, Default type to PL/SQL Expression and setting the default to sysdate. We've also tried caputuring a date on the previous page and loading it onto the report page and trying to default the date column to a page item default.
I'd appreciate any help.
Thanks
FYI - we are using version 3.2use as default
to_char(sysdate, 'dd/mm/yyy') where the format is your application or item date format -
Is there a way to create SQL Dev reports with validated binds?
Is there a way to create SQL Dev reports with validated binds similar to the way user defined extensions can have <prompts> with a <value> that is a SQL statement returning a list of possible values?
This sure would make select appropriate values for binds in reports easier and less error prone.Maybe a forum search on "Windows registry" would turn up some useful things. You're not the first to ask this. You might save yourself and everyone else some time if you'd simply do that.
-
Database Logon Failed which created by Crystal Report 2008
this time i meet the famous error again which is database logon failed.
i created a crystal report 2008 starting from blank report, then connect with odbc
i use 2008 method
objRpt.SetDatabaseLogon(db_username, db_password, odbc_name, database_name);
2008 method will get database logon failed even set database location and verify database again
then i use 8.5 method and try again for 2008 report. it said field name is unknown for one of formula
then i drag field again for formula and set database location and verify database again
it said the same error.
then i uninstall 8.5 crytal report software in window 7 deployment machine, and do above again, it said the same error
//'Create a new Stored Procedure Table to replace the reports current table.
CrystalDecisions.ReportAppServer.DataDefModel.Procedure boTable = new CrystalDecisions.ReportAppServer.DataDefModel.Procedure();
//'boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
PropertyBag boMainPropertyBag = new PropertyBag();
//'boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
//'In the main property bag (boMainPropertyBag)
PropertyBag boInnerPropertyBag = new PropertyBag();
//'Set the attributes for the boInnerPropertyBag
boInnerPropertyBag.Add("Connect Timeout", "15");
//boInnerPropertyBag.Add("Data Source", "MyDataSource");
boInnerPropertyBag.Add("Data Source", "10.1.1.191");
boInnerPropertyBag.Add("DataTypeCompatibility", "0");
boInnerPropertyBag.Add("General Timeout", "0");
//boInnerPropertyBag.Add("Initial Catalog", "MyCatalog");
boInnerPropertyBag.Add("Initial Catalog", database_name);
boInnerPropertyBag.Add("Integrated Security", "False");
boInnerPropertyBag.Add("Locale Identifier", "1033");
boInnerPropertyBag.Add("MARS Connection", "0");
//boInnerPropertyBag.Add("OLE DB Services", "-5");
//boInnerPropertyBag.Add("ODBC", "-5");
boInnerPropertyBag.Add("ODBC", "Cheque");
boInnerPropertyBag.Add("Provider", "SQLNCLI");
boInnerPropertyBag.Add("Tag with column collation when possible", "0");
boInnerPropertyBag.Add("Trust Server Certificate", "0");
boInnerPropertyBag.Add("Use Encryption for Data", "0");
//'Set the attributes for the boMainPropertyBag
boMainPropertyBag.Add("Database DLL", "crdb_ado.dll");
//boMainPropertyBag.Add("Database DLL", "p2sodbc.dll");
//boMainPropertyBag.Add("QE_DatabaseName", "VEPILOT");
boMainPropertyBag.Add("QE_DatabaseName", database_name);
//boMainPropertyBag.Add("QE_DatabaseType", "OLE DB (ADO)");
boMainPropertyBag.Add("QE_DatabaseType", "ODBC");
//'Add the QE_LogonProperties we set in the boInnerPropertyBag Object
boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
boMainPropertyBag.Add("QE_ServerDescription", "MyServer");
boMainPropertyBag.Add("QE_SQLDB", "True");
boMainPropertyBag.Add("SSO Enabled", "False");
//'Create a new ConnectionInfo object
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo = new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
//'Pass the database properties to a connection info object
boConnectionInfo.Attributes = boMainPropertyBag;
//'Set the connection kind
boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
//'*EDIT* Set the User Name and Password if required.
boConnectionInfo.UserName = db_username;
boConnectionInfo.Password = db_password;
//'Pass the connection information to the table
boTable.ConnectionInfo = boConnectionInfo;
CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables = objRpt.ReportClientDocument.DatabaseController.Database.Tables;
CrystalDecisions.CrystalReports.Engine.Tables tables = objRpt.Database.Tables;
foreach (CrystalDecisions.CrystalReports.Engine.Table table in tables)
if (!string.IsNullOrEmpty(table.Name))
//boTable.Name = table.Name;
//boTable.QualifiedName = database_name + ".dbo." + table.Name;
//boTable.Alias = table.Name;
boTable.Name = "sp_ChequeIssueDetRpt";
boTable.QualifiedName = database_name + ".dbo.sp_ChequeIssueDetRpt";
boTable.Alias = "sp_ChequeIssueDetRpt";
objRpt.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
objRpt.VerifyDatabase();
http://sourceforge.net/projects/aspchequesprint/files/ChequeIssueDet.rpt/downloadNo subreport, only a stored procedure with final two lines are
print @m_sql
exec (@m_sql)
After use generated code in the link above
Error at boReportDocument.VerifyDatabase();
Inner Exception : no error
Message "Logon failed"
ErrorID : CrystalDecisions.CrystalReports.Engine.EngineExceptionErrorID.LogOnFailed
HelpLink : null
stacktrace : CrystalDecisions.CrystalReports.Engine.ReportDocument.VerifyDatabase()\r\n at viewReport.Page_Load(Object sender, EventArgs e) 於 d:
Data
My Documents
Visual Studio 2008
WebSites
Cheques
viewReport.aspx.cs: row 1302\r\n at System.Web.Util.CalliHelper.EventArgFunctionCaller(IntPtr fp, Object o, Object t, EventArgs e)\r\n at System.Web.Util.CalliEventHandlerDelegateProxy.Callback(Object sender, EventArgs e)\r\n at System.Web.UI.Control.OnLoad(EventArgs e)\r\n at System.Web.UI.Control.LoadRecursive()\r\n 於 System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
TargetSite : {Void VerifyDatabase()}
string reportPath = report_path + "ChequeIssueDet.rpt";
boReportDocument = new ReportDocument();
//**EDIT** Change the path and report name to the report you want to change.
boReportDocument.Load(reportPath, OpenReportMethod.OpenReportByTempCopy);
//Create a new Stored Procedure Table to replace the reports current table.
CrystalDecisions.ReportAppServer.DataDefModel.Procedure boTable =
new CrystalDecisions.ReportAppServer.DataDefModel.Procedure();
//boMainPropertyBag: These hold the attributes of the tables ConnectionInfo object
PropertyBag boMainPropertyBag = new PropertyBag();
//boInnerPropertyBag: These hold the attributes for the QE_LogonProperties
//In the main property bag (boMainPropertyBag)
PropertyBag boInnerPropertyBag = new PropertyBag();
//Set the attributes for the boInnerPropertyBag
boInnerPropertyBag.Add("Database", database_name);
boInnerPropertyBag.Add("DSN", "Cheque");
boInnerPropertyBag.Add("UseDSNProperties", "False");
//Set the attributes for the boMainPropertyBag
boMainPropertyBag.Add("Database DLL", "crdb_odbc.dll");
boMainPropertyBag.Add("QE_DatabaseName", database_name);
boMainPropertyBag.Add("QE_DatabaseType", "ODBC (RDO)");
//Add the QE_LogonProperties we set in the boInnerPropertyBag Object
boMainPropertyBag.Add("QE_LogonProperties", boInnerPropertyBag);
boMainPropertyBag.Add("QE_ServerDescription", "Cheque");
boMainPropertyBag.Add("QE_SQLDB", "True");
boMainPropertyBag.Add("SSO Enabled", "False");
//Create a new ConnectionInfo object
CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo boConnectionInfo =
new CrystalDecisions.ReportAppServer.DataDefModel.ConnectionInfo();
//Pass the database properties to a connection info object
boConnectionInfo.Attributes = boMainPropertyBag;
//Set the connection kind
boConnectionInfo.Kind = CrConnectionInfoKindEnum.crConnectionInfoKindCRQE;
//**EDIT** Set the User Name and Password if required.
boConnectionInfo.UserName = db_username;
boConnectionInfo.Password = db_password;
//Pass the connection information to the table
boTable.ConnectionInfo = boConnectionInfo;
//Get the Database Tables Collection for your report
CrystalDecisions.ReportAppServer.DataDefModel.Tables boTables;
boTables = boReportDocument.ReportClientDocument.DatabaseController.Database.Tables;
//For each table in the report:
// - Set the Table Name properties.
// - Set the table location in the report to use the new modified table
boTable.Name = "sp_ChequeIssueDetRpt;1";
boTable.QualifiedName = database_name+".dbo.sp_ChequeIssueDetRpt;1";
boTable.Alias = "sp_ChequeIssueDetRpt;1";
boReportDocument.ReportClientDocument.DatabaseController.SetTableLocation(boTables[0], boTable);
//Verify the database after adding substituting the new table.
//To ensure that the table updates properly when adding Command tables or Stored Procedures.
boReportDocument.VerifyDatabase();
//**EDIT** Set the value for the Stored Procedure parameters.
string m_curUser = "";
int spid = Convert.ToInt32(Request.Cookies["login_cookie"]["spid"]);
queryString = "select * from v_All_Session where SPID=" + spid.ToString();
//string _connectionString = ConfigurationManager.ConnectionStrings["ChequeConnectionString"].ConnectionString;
using (SqlConnection connection = new SqlConnection(_connectionString))
SqlCommand command = connection.CreateCommand();
command.CommandText = queryString;
connection.Open();
using (SqlDataReader datareader = command.ExecuteReader())
if (datareader.HasRows == true)
while (datareader.Read())
if (datareader["UserID"] != System.DBNull.Value)
m_curUser = datareader["UserID"].ToString();
datareader.Close();
connection.Close();
boReportDocument.SetParameterValue("@UserID", m_curUser);
if (string.IsNullOrEmpty(Session["fm_CoCode"].ToString()))
boReportDocument.SetParameterValue("@fm_CoCode", Session["fm_CoCode"].ToString());
if (string.IsNullOrEmpty(Session["to_CoCode"].ToString()))
boReportDocument.SetParameterValue("@to_CoCode", Session["to_CoCode"].ToString());
if (string.IsNullOrEmpty(Session["fm_BankACNo"].ToString()))
boReportDocument.SetParameterValue("@fm_BankACNo", Session["fm_BankACNo"].ToString());
if (string.IsNullOrEmpty(Session["to_BankACNo"].ToString()))
boReportDocument.SetParameterValue("@to_BankACNo", Session["to_BankACNo"].ToString());
if (string.IsNullOrEmpty(Session["fm_BatchNo"].ToString()))
boReportDocument.SetParameterValue("@fm_BatchNo", Session["fm_BatchNo"].ToString());
if (string.IsNullOrEmpty(Session["to_BatchNo"].ToString()))
boReportDocument.SetParameterValue("@to_BatchNo", Session["to_BatchNo"].ToString());
Edited by: Mathew_666 on Jul 19, 2011 4:27 AM
Edited by: Mathew_666 on Jul 19, 2011 4:28 AM
Maybe you are looking for
-
Automatically Selecting Values in Multiple Values Dropdown Parameters
Hi, Is it possible to have parameter values automatically selected in a dropdown in an SSRS report? I'm using SQL Server 2008 R2 Enterprise edition. Basically what I have in mind is this: The user wants to save his parameter selections in a table
-
Excel is still live after closing it
Hello all! I'm using LabVIEW 7.1 and Excel 2000 for report generation (without report generation toolkit). My problem is that even if I close all references and I quit Excel, it is still live (looking at task manager). My OS is Win2000. I noticed tha
-
how do you know which updates you need for your a second generation ipod touch. I havent used my ipod touch in forever and now no matter what i do no matter how many times i restart everything it still wont show up in itunes or my pc when its connect
-
OS X partition not available in bootcamp
I've installed Windows 7 on my MacBookPro using bootcamp, but when I boot in Windows I am not able to access my OS X partitions. Looking into the Disk Manager it looks like all partitions (OS X & Windows) are part of one disk and I cannot assign driv
-
Two selectionOneMany boxes, Value not valid option problem
HI I have two selectionOneMany components on a page. Its just like the case in which a selectionOneMany for a country when changed updates the second selectionOneMany for its cities. In my code I have defered the valuechangelistener for the first com