| | |
Extracting report form oracle database
Please support our C# advertiser: Programming Forums - DaniWeb Sister Site
![]() |
•
•
Join Date: Sep 2009
Posts: 7
Reputation:
Solved Threads: 0
hi every body
i have a trouble with viewing the report from using the following environments
C# - Crystalreport - Oracle database
i regularly use the basic way to call a view form the database and extract the data form it like that
and then create a report depending on this view
and regally connect your report viewer with this view
and its working with viewing the report via crystalreport
it's absolutely good for access database ans SQL server
but i's so bad when dealing with oracle database
when i use this past method i found a messagebox showing tell me that it need the user password in oracle database
so i have a trouble to make instance from my report in c#
i follow the following method but it also doesn't work !!
so if you have any idea what i'm wrong about please tell me
thanks a lot
i have a trouble with viewing the report from using the following environments
C# - Crystalreport - Oracle database
i regularly use the basic way to call a view form the database and extract the data form it like that
C# Syntax (Toggle Plain Text)
cmd.commandtext= "Create view as select * from table1 where icode = '10'"; cmd.excutenonquery();
and then create a report depending on this view
and regally connect your report viewer with this view
and its working with viewing the report via crystalreport
it's absolutely good for access database ans SQL server
but i's so bad when dealing with oracle database
when i use this past method i found a messagebox showing tell me that it need the user password in oracle database
so i have a trouble to make instance from my report in c#
i follow the following method but it also doesn't work !!
C# Syntax (Toggle Plain Text)
OleDbConnection cn = new OleDbConnection(); OleDbCommand cmdtest = new OleDbCommand(); OleDbDataReader drrr; OleDbDataAdapter ad = new OleDbDataAdapter(); DataTable dt = new DataTable(); if (cn.State == ConnectionState.Closed) { cn.ConnectionString = "provider=oraoledb.oracle.1;password=123;user id = system;"; cn.Open(); } DataSet ds = new DataSet(); cmdtest.Connection = cn; cmdtest.CommandType = CommandType.Text; cmdtest.CommandText = "select * from doc "; drrr = cmdtest.ExecuteReader(); drrr.Close(); CrystalDecisions.CrystalReports.Engine.ReportClass ss = new CrystalDecisions.CrystalReports.Engine.ReportClass(); ad.SelectCommand = cmdtest; ad.Fill(ds, "doc"); ss.ResourceName = "docreport.rpt"; ss.SetDataSource(ds.Tables["doc"]); crystalReportViewer1.ReportSource = ss;
so if you have any idea what i'm wrong about please tell me
thanks a lot
•
•
Join Date: Jul 2009
Posts: 972
Reputation:
Solved Threads: 213
0
#2 Oct 26th, 2009
It sounds like you need to set the report's connection info for each of the tables. Try passing in the ReportDocument to this after you have set the table parameters, but before attempting to run/view the report:
C# Syntax (Toggle Plain Text)
public static void ReportSourceSetup(ReportDocument crDoc, ConnectionInfo crConnectionInfo) { // Each table in report needs to have logoninfo setup: Tables crTables = crDoc.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables) { TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo; crTableLogonInfo.ConnectionInfo = crConnectionInfo; crTable.ApplyLogOnInfo(crTableLogonInfo); } }
•
•
Join Date: Sep 2009
Posts: 7
Reputation:
Solved Threads: 0
0
#4 Oct 27th, 2009
hi DdoubleD
most thanks about your share
but if you tell me the complete right way for this problem !!!
cause i try to follow your steps but there's something missing in my steps...
so please tell me the whole way to it
thanks a lot
samehsenosi
most thanks about your share
but if you tell me the complete right way for this problem !!!
cause i try to follow your steps but there's something missing in my steps...
so please tell me the whole way to it
thanks a lot
•
•
•
•
It sounds like you need to set the report's connection info for each of the tables. Try passing in the ReportDocument to this after you have set the table parameters, but before attempting to run/view the report:
C# Syntax (Toggle Plain Text)
public static void ReportSourceSetup(ReportDocument crDoc, ConnectionInfo crConnectionInfo) { // Each table in report needs to have logoninfo setup: Tables crTables = crDoc.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables) { TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo; crTableLogonInfo.ConnectionInfo = crConnectionInfo; crTable.ApplyLogOnInfo(crTableLogonInfo); } }
samehsenosi
•
•
Join Date: Jul 2009
Posts: 972
Reputation:
Solved Threads: 213
0
#5 Oct 27th, 2009
Is this what you are looking for?:
C# Syntax (Toggle Plain Text)
private void RunMyReport(ReportDocument crDoc) { ConnectionInfo crConnectionInfo = new ConnectionInfo(); crConnectionInfo.ServerName = "YOUR SERVER NAME"; crConnectionInfo.DatabaseName = "YOUR DATABASE NAME"; crConnectionInfo.UserID = "YOUR DATABASE USERNAME"; crConnectionInfo.Password = "YOUR DATABASE PASSWORD"; // setup before passing to the viewer... ReportSourceSetup(crDoc, crConnectionInfo); crystalReportViewer1.ReportSource = crDoc; crystalReportViewer1.Refresh(); } public static void ReportSourceSetup(ReportDocument crDoc, ConnectionInfo crConnectionInfo) { // Each table in report needs to have logoninfo setup: Tables crTables = crDoc.Database.Tables; foreach (CrystalDecisions.CrystalReports.Engine.Table crTable in crTables) { TableLogOnInfo crTableLogonInfo = crTable.LogOnInfo; crTableLogonInfo.ConnectionInfo = crConnectionInfo; crTable.ApplyLogOnInfo(crTableLogonInfo); } } // calling... RunMyReport(ss);
![]() |
Similar Threads
- calling oracle report from form builder (Oracle)
- Accessing Oracle Database from Microsoft Word Macro (Visual Basic 4 / 5 / 6)
- Need help in showing the report on Vb form (Visual Basic 4 / 5 / 6)
- How to connect Oracle database from JSP page (Java)
- Need Crystal report calling Oracle forms 10G (Oracle)
- how to connect oracle 8i database with jsp page (JSP)
- connecting jsp with oracle database (JSP)
- Posting form data to an Oracle database (JavaScript / DHTML / AJAX)
Other Threads in the C# Forum
- Previous Thread: Calling a methond
- Next Thread: how to get the row id of the clicked row in a HTML table using c#
Views: 630 | Replies: 4
| Thread Tools | Search this Thread |
Tag cloud for c#, oracle
.net 2d access acquisition activedirectory analyst apache app array asp.net associations bartz c# c++ certfication chat class client combobox concurrency connection console contorl cs4 data database datetime degrees development dialog drawing enterprisesoftware excel expression file foreach form formatting forms gdi+ google httpwebrequest ibm index internet java javascript larryellison linux linux+ lisp list listbox login math microsoft mysql networking nortel novell open operatingsystem operator oracle path photoshop php picturebox platform post programmer programming read redhat remote remoting resource richtextbox saas saving sql sql-server sqlserver string sun tables textbox treeview using-keyword validate validation virtualiron visualstudio vmware webbrowser windows winforms wpf xml yahoo






