Crystal Report - More than one table from MySql
Hello, I am in need of help big time.
I have am using Visual Studio 2010 and Crystal Report 10.
The problem that I am incounting is that I am unable to retreive data from more than one table from a MySql database. I have been stuck on this for too long and need to hjump the hurdle.
I am using a MySql connection string, a dataset and a crystal report which is based on the dataset.
The main error that I am having is, the browser opens and a form appears saying "The report you requetsed requires further information" With the Server name: DataSetPropertiesDetials, while the User name and Password fields are then enabled.
I am guessing I am missing something in my code.
When I retreive data from one table the report is fine, but when I try to use more than one table it throws the error.
My Code is below and also attached:
Imports System.Data.SqlClient
Imports System.Configuration
Imports MySql.Data.MySqlClient
Imports CrystalDecisions.ReportSource
Imports CrystalDecisions.Web
Imports CrystalDecisions.CrystalReports.Engine
Imports CrystalDecisions.Shared
Public Class _Default
Inherits System.Web.UI.Page
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
Dim con As MySqlConnection
Dim rpt As New CrystalReport3()
Dim myReport As New ReportDocument
Dim myData As New DataSet
Dim cmd As New MySqlCommand
Dim cmdUser, cmdProperty, cmdBranch As New MySqlCommand
Dim daBranch, daProperty, daUser As New MySqlDataAdapter
con = New MySqlConnection()
'Connection String
con.ConnectionString = "Server=****;Database=***;UID=***;Password=****"
Try
con.Open()
cmdBranch.CommandText = "SELECT branch FROM tblbranch"
cmdBranch.Connection = con
daBranch.SelectCommand = cmdBranch
daBranch.Fill(myData)
cmdProperty.CommandText = "SELECT ref, keys_held, key_no, keys_out, no_name, address_line1, address_line2,key_label FROM tblproperty"
cmdProperty.Connection = con
daProperty.SelectCommand = cmdProperty
daProperty.Fill(myData)
cmdUser.CommandText = "SELECT known_name FROM tbluser"
cmdUser.Connection = con
daUser.SelectCommand = cmdUser
daUser.Fill(myData)
myReport.Load("REPORT LOCATION")
myReport.SetDataSource(myData)
myReport.Database.Tables(0).SetDataSource(myData.Tables(0))
CrystalReportViewer1.ReportSource = myReport '
Catch myerror As MySqlException
MsgBox(myerror.Message)
End Try
End Sub
End Class
Hi,
You have 3 SQL commands but you are calling SetDataSource only once. You need to look through for each of the SQL Commands.
Good luck,
Brian
Similar Messages
-
How do i insert into more than one table from temp table?
Hi,
I have three tables such as temp,stck and stol
temp table contains data as below. It has 22 columns.
STOCK STOCKDESC ALIAS1 ALIAS2 ALIAS3 ALIAS4 ALIAS5 ALIAS6 ALIAS7 ALIAS8 ALIAS9 ALIAS10 ALIAS11 ALIAS12 ALIAS13 ALIAS14 ALIAS15 ALIAS16 ALIAS17 ALIAS18 ALIAS19 ALIAS20
bmg667691031 NOWE FINANSE LTD yy zz B282DV3 TESTICKER te te1 bmg667691031BM te 707943W ex IR-PRIME IR-ALTID IR-BLOOM NT-PRIME NT-ALTID NT-BLOOM AU-PRIME AU-ALTID AU-BLOOM mm
AA0098000181 UFACEX HOLDINGS VAR RT DUE 06-30-2010 kk yy mm TESTICKER aa ff AA0098000181GB bb 031969W cc IR-PRIME IR-ALTID IR-BLOOM NT-PRIME NT-ALTID NT-BLOOM AU-PRIME AU-ALTID AU-BLOOM ba
AC1350Z7M923 CDA GOVT TREAS BILLS CDS- 08-05-2010 ee ff gg TESTICKER hh ij AC1350Z7M923CA mn 1A1MTLU op IR-PRIME IR-ALTID IR-BLOOM NT-PRIME NT-ALTID NT-BLOOM AU-PRIME AU-ALTID AU-BLOOM op
stck table contains as below.It has six columns. But always first three columns will have values.
stock_id stock_code stock_description stock_type terriory_code preferred code
1185072 AED
1185073 ARA CURRENCY ARGENTINA PESO
1185074 ATS CURRENCY AUSTRIAN SCHS
stol table contains as below. It has 6 columns.Terriory_code is always empty.
stock_code territory_code stol_type stock_id stck_code_type sys_entry_date
AED 0 1185072 0 6/22/2007 3:59:13.000 PM
ARA 0 1185073 0 6/22/2007 3:59:13.000 PM
ATS 0 1185074 0 6/22/2007 3:59:13.000 PM
Now, i want to insert into stck and stol table based on temp table records. constraints to insert into stck and stol tables are as below
In temp table first column is called stock. This stock has to compare with stck table stock_code. If it is not present in stck table, then it has to insert into stck table with stock_id and stock_description. Here, I need to generate stock_id my self in the code.
In temp table, column 3 to column 22, i have alias. Each column has to check with stol table stock_code column. For instance, column3 check with stock_code column. Then column4 check with stock_code. If stock_code is not present in stol table, then i have to insert into stol table.
I need to generate stock,id in the code. How do i perform this insertion?
Edited by: user12852882 on Jun 12, 2010 2:37 AMIt can be done using SQL (no loops required)
insert into stock_table (stock_id,stock_code,stock_description)
select stock_id,get_stock_code,stockdesc /* get_stock_code is a function providing stock_code - usually a sequence value */
from (select t.stock stock_id,t.stockdesc,s.stock_id stock_stock_id
from temp_table t,stock_table s
where t.stock = s.stock_id(+)
where s.stock_id is null;
insert into stol_table (stock_code,sys_entry_date) /* not clear where other values to be inserted will come from */
select stock_code,sysdate
from (select t.stock_code,s.stock_code stol_stock_code
from (select distinct stock_code
from (select alias1 stock_code from temp_table union all
select alias2 from temp_table union all
select alias3 from temp_table union all
select alias4 from temp_table union all
select alias5 from temp_table union all
select alias6 from temp_table union all
select alias7 from temp_table union all
select alias8 from temp_table union all
select alias9 from temp_table union all
select alias10 from temp_table union all
select alias11 from temp_table union all
select alias12 from temp_table union all
select alias13 from temp_table union all
select alias14 from temp_table union all
select alias15 from temp_table union all
select alias16 from temp_table union all
select alias17 from temp_table union all
select alias18 from temp_table union all
select alias19 from temp_table union all
select alias20 from temp_table
) /* use unpivot instead if you are 11g */
where stock_code is not null
) t,stol_table s
where t.stock_code = s.stock_code(+)
where s.stock_code is null;
and think about damorgan's post, you'll never regret it (especially when you will not just think)
Regards
Etbin -
Layout issue - More than one table sections on report?
Hello all
I am wondering if any of you know if there is a way to have more than one table or table field on a report.
I'm asking this because I'd like to include a large number of fields in one report, but then that makes the report hard to read (everything is on one long line).
I am wondering if there is a way to have more than one table section on a report so I could have the address information at the top of the report than have other additional information below the address. Basically I'm interested in making things easier to read for the user.Use Pivot tables to isolate the columns you want in each table in your report.
Mike L -
JDBC-XI-FILE scenario. How to extract data from more than one table in JDBC
Hi,
I was asked a question like in JDBC-XI-FILE scenario........ How to extract data from more than one tables (i.e from JDBC system) ?? What is the logic to do the same ??
I am not sure whether this is a valid question..........but any help in this regards is highly appreciated.
Regards
KumarHI,
Yes it can be possible ,please see the following links
JDBC Receiver with Oracle Stored Procedures
configuring jdbc adapter with multiple tables
RFC -> XI -> JDBC Scenario Updating Multiple Tables
/people/alessandro.berta/blog/2005/10/04/save-time-with-generalized-jdbc-datatypes
JDBC Adapter multiple Selects
https://www.sdn.sap.com/irj/sdn/advancedsearch?query=jdbc%20with%20multiple%20tables&cat=sdn_all
Regards
Chilla.. -
Fetching more than one row from a table after selecting one value from the dropdown
Hi Experts,
How can we fetch more than one row from a table after selecting one value from the dropdown.
The scenario is that I have some entries in the dropdown like below
A B C
11256 VID 911256
11256 VID 811256
11256 SONY 11256
The 'B' values are there in the dropdown. I have removed the duplicate entries from the dropdown so now the dropdownlist has only two values.for eg- 'VID' and'SONY'. So now, after selecting 'VID' from the dropdown I should get all the 'C' values. After this the "C' values are to be passed to other methods to fetch some data from other tables.
Request your help on this.
Thanks,
Preeetam Narkhede.Hi Preetam!
I hope I understand your request proberly, since this is more about Java and less about WebDynpro, but if I'm wrong, just follow up on this.
Supposed you have some collection of your original table data stored in variable "origin". Populate a Hashtable using the values from column "B" (let's assume it's Strings) as keys and an ArrayList of whatever "C" is (let's assume String instances, too) as value (there's a lot of ways to iterate over whatever your datasource is, and since we do not know what your datasource is, maybe you'll have to follow another approach to get b and c vaues,but the principle should remain the same):
// Declare a private variable for your Data at the appropriate place in your code
private Hashtable temp = new Hashtable<String, ArrayList<String>>();
// Then, in the method you use to retrieve backend data and populate the dropdown,
// populate the Hashtable, too
Iterator<TableData> a = origin.iterator();
while (a.hasNext()) {
TableData current = a.next();
String b = current.getB();
String c = current.getC();
ArrayList<String> values = this.temp.get(b);
if (values == null) {
values = new ArrayList<String>();
values.add(c);
this.temp.put(b, values);
So after this, you'll have a Hashtable with the B values als keys and collections of C values of this particular B as value:
VID --> (911256, 811256)
SONY --> (11256)
Use
temp.keySet()
to populate your dropdown.
After the user selects an entry from the dropdown (let's say stored in variable selectedB), you will be able to retrieve the collection of c's from your Hashtable
// In the metod you handle the selection event with, get the c value collection
//and use it to select from your other table
ArrayList<String> selectedCs = this.temp.get(selectedB);
// now iterate over the selectedCs items and use each of these
//to continue retrieving whatever data you need...
for (String oneC : selectedCs) {
// Select Data from backend using oneC in the where-Clause or whatever...
Hope that helps
Michael -
How to bring the more than one rows from the table into the script
Hi
I have to bring more than one rows from the table into the Main windows of the script. so plz help me out.
Thanks in Advance
AnanyaHi Ananya,
Bring more than one row into main window of script.
For this you need to do some changes for data which you pass to main window.At a time you need to pass more than one row,so for this you need to define one structure.See below code.
Types:begin of ty_rows,
include structure (your row_structure),
include structure (your row_sturcture),
Types:end of ty_rows.
for example....
If i need to pass 2 vendor details at a time to main window then the structure should be like this.
Types:begin of ty_rows,
vendor1 like lfa1-lifnr,
vendor1_name like lfa1-name1,
vendor2 like lfa1-lifnr,
vendor2_name like lfa1-name1,
end of ty_rows.
Data:i_main type standard table of ty_rows,
wa_main type ty_rows.
Based on condition you can pass more than one rows of your actual internal table data to i_main internal table.
Then you can pass i_main internal table to your main window.
I think this will help you.
Cheers,
Bujji -
More than one Table of Contents
Does anyone know if RoboHelp now offers the ability to create
more than one table of contents for a help project?Leon is right. The "workaround" we have used for years is to
create multiple TOC (projectname.hhc) or Index (.hhk) files and
archive them somewhere for safekeeping. Then use them to overwrite
the existing ones in the project. It works but it's really
inconvenient and you really have to pay attention to an archive
naming scheme because the filenames must be the same as the project
name.
However, I just noticed that I forgot to report in my Adobe
RoboHelp 7 sneak peek wrap up an even more robust implementation.
BTW, here's the URL Peter mentioned
http://tinyurl.com/2ldt7e
Not only will you have multiple TOC/Index and Glossary
definitions - you will also have the ability to add a "placeholder"
from one custom TOC to another. It's a reference that can be placed
anywhere in the hierarchy of the TOC. It works in a similar way
that the Merged TOC icon works now. Way cool and takes the TOC
(Index) to another level. They will also play nice with RoboSource
Control if you are using that.
Thanx,
john -
Can more than one table be updated from a single form that was created using a wizard? If so, how? I tried firing a trigger to add a new record to another table, but get this message "No updatable report found. Multi row updated and delete operations can only be performed on tabular forms of type "Updateable Report"
Thanks
JohnHi John B
Please make sure you explain to forum when asking for help.
What version of Apex your using.
Database Version:
Browser etc.
Yes you can update multiple tables from one single form. I'm not 100% sure about the wizard part, because before anyone can answer that we need to know which version of Apex your using? -
How to delete the double records connected to one or more than one tables in SQL 2008?
Hi
Can anyone please help me with the SQL query. I Im having a table called People with columns names: personno., lastname, firstname and so on. The personno. is having duplicate records,so all the duplicate records i have written with "double" in
the beginning of the numbers. I tried deleting these double records but they are linked to one or more than one tables. I have to find out, all the tables blocking the deleting of double person. And then create select statements which creates update statements
in order to replace the current id of double person with substitute id. (The personno. is in the form of id's in the database)
ThanksYou should not append "double" in the personno. When we append it will not be able to join or relate to other table. Keep the id as it is and use another field(STATUS) to mark as duplicate. Also we will require another field(PRIMARYID) against
those duplicate rows i.e the main or the primary personno.
SELECT * FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
UPDATE OtherTable SET personno = b.primaryid
FROM OtherTable a INNER JOIN
(SELECT personno, status, primaryid FROM PEOPLE WHERE status = 'Duplicate') b
ON a.personno = b.personno
NOTE: Please take backup before applying the query. This is not tested.
Regards, RSingh -
Oracle OUTER JOIN on more than one table
Hi!
Friends, please help with this urgent problem: How can an outer join be written on more than one table?
An SQL Server query:
SELECT * from a INNER JOIN b on a.id = b.id LEFT OUTER JOIN c ON c.id = a.id AND c.id = b.id
works fine with SQL SERVER
But Oracle query:
SELECT * from a,b,c WHERE a.id = b.id AND a.id = c.id (+) AND b.id = c.id (+)
gives an error: OUTER JOIN cannot be used on more than one table? Why?
I use OracleDriver from classes12.zip to connect to Oracle8i database.
Please, help!The Oracle 8i and later SQL reference reads that the following "join_types" are supported and under this syntax it does not limit the LEFT OUTER JOIN (syntax the same as SQLServer example in original note) to two tables as implied in these notes:
The join_type indicates the kind of join being performed:
Specify INNER to indicate explicitly that an inner join is being performed. This is the default.
Specify RIGHT to indicate a right outer join.
Specify LEFT to indicate a left outer join.
Specify FULL to indicate a full or two-sided outer join. In addition to the inner join, rows from both tables that have not been returned in the result of the inner join will be preserved and extended with nulls.
You can specify the optional OUTER keyword following RIGHT, LEFT, or FULL to explicitly clarify that an outer join is being performed. -
Failed to upgrade more than one table at same time
Hi
In Deployment Manager, I failed to upgrade more than one table at same time.
I tried to hightlight 4 tables and set the default action as Upgrade, and click File/Generate Deploy. It passed the code generation step then I click Deploy, they are all failed with no error message.
But they are all successful when I upgrade them one by one. Any one has any idea about this?
For the known reason, we have no choice to do the deployment with action of 'upgrade' through OMBPlus, instead, can only do that interactively through OWB Client. I can't imagine to ask our Production side DBA to upgrade 80 tables one by one. Or I have to use the generated scripts to do the upgrade, which will resulted in 'no deploy status updated' in OWB. Any help will be very appricated.
The version I'm using is OWB 10g.
Thanks,
DamingHi
First of all, Patrick's solution doesn't work for me. I didn't do cloning and there is no problem when check the WB tables.
Second, I think your solution is only good for the developing environment just to get tables upgrade via deployment manager. In most cases, when you do a new release on PROD environment you just exp/imp the MDL file from DEV to PROD and any developing is not recommended on PROD. But your approach is trying to manually the DB, and then EDIT the mapping to do the Reconcile and then deploy. Surely you can do that if you have full control on your PROD side. However, in my situation, I have no access to the PROD for the security reason and an DBA Operator of the Client is responsible to implement my Migration process on PROD by himself. -
How to create Criterian For more than one table
Hi,
I have one problem how to create criteria for more than one table in that using one criteria hot to get the values from database in that more than onetable for getting these values .Please send me the exampke code.
reagrds,
raghuHi,
I don't think its possible to create fieldcatalog for different tables,
but if you want to do so create a dummy table which has all the fields which you want in fieldcatalog.
populate the data from different table to that dummy table
then create fieldcatalog for that table and pass it in the function module...
Regards,
Siddarth -
More than one table of content
Hi,
I need to put more than one table of content (contents, illustrations, tables). Is there a way to do this? When I add the second table, the first one disapears.
Thank you!Techicly you can have multiple TOC, but
they won't cover over the same pages.
Each one will cover from where they are up to the next one.
There is a walk around.
Since table of content table of illustation usaully are numbered independly
from the reste of the text, you will have to put extra care only with the table of content.
Make the right amount of page nessairy for all your table, and place theire name.
(You may have to input manully the part about «pre-text» of your table of content depending
of your numbering)
Put the right name in the right style.
Make your table of content then print it.
Input your table of illustration at the desire page (make sure page number still match),
change TOC setting to have what you want.
Print those page.
Do this for all your TOC.
If you only have 2 or 3 entry don't bother with that.
But if you got a lot like over 40 illustrations (like in the one I'm doing right now)
that can be a good option. -
How to use left outer join on more than one table (source)
Hi all,
In our project we are converting the Unix shell & SQL scripts into OWB mappings. We are facing problem converting left outer join in OWB. here is one of the example. i have just pasted the FROM and where condition.
FROM ym_scr t1, branch_finmonth t3
LEFT OUTER JOIN item_image t2
ON (t1.branch_no = t2.branch_no
AND t1.item_no = t2.item_no
AND t3.to_date between t2.tran_dt and t2.to_dt
AND t2.to_dt >= '$start_images' ) <<<========= '$start_images' THIS COMES FROM THE UNIX VARAIBLE ,
We converts the same when we are putting it in OWB join Operator
INGRP1.branch_no = INGRP2.branch_no(+)
AND INGRP1.item_no = INGRP2.item_no(+)
AND INGRP3.to_date between t2.tran_dt and t2.to_dt
AND INGRP2.to_dt >= INGRP2.start_images
But as you see in the OWB opreator we can put left join with INGRP1 with INGRP2.
We can not make same join with INGRP3 & INGRP4 , becoz it failed saying "you cannot left outer join on more than one table/source".
so overall this OWB code makes incomplete left outer join as per the above ANSI SQL join in Oracle.
Bcoz of the problem we are getting less number of rows...........
SO please please help me on this
Regards
AshokHi.
I know this topic is here for a while now, but I had the same problem today, searched for help and didn´t find anything.
Later I figured out how to do this.
You just have to put the (+) one time, and the OWB converts in an LEFT OUTER JOIN statement.
For this case, all you have to do is:
( INGRP1.branch_no = INGRP2.branch_no(+) AND INGRP1.item_no = INGRP2.item_no AND INGRP2.to_dt >= INGRP2.start_images )
Regards,
Godoy -
Persisting CMP bean over more than one table
Hello,
I was wondering if it is possible to persist an Entity Bean over more than
one table using CMP. For example 3 attributes go in table A and 2 attributes
go in table B.
I can see this might come in handy when having some kind of inheritance in
your architecture.
Thanks,
Rein ReezigtCMP are based on one DB object however object could be a database table or a
view. You can create a view and base your bean on that view. This is mostly
useful for read-only entity beans that just do select queries because databases
have all kind of different restrictions on update froma view, ( for example
ORACLE allows update to only one table in view). However in case you need a
logical abstraction of multiple tables, consider EJB2.0 relations or a product
like toplink for your object to relational mapping.
Viresh Garg
Principal Developer Relations Engineer
BEA Systems
Rein Reezigt wrote:
Hello,
I was wondering if it is possible to persist an Entity Bean over more than
one table using CMP. For example 3 attributes go in table A and 2 attributes
go in table B.
I can see this might come in handy when having some kind of inheritance in
your architecture.
Thanks,
Rein Reezigt
Maybe you are looking for
-
Exclusive update release for Adobe Cloud customers
Excuse me, Adobe. Don't get this wrong, I personally have nothing against Adobe. Please know and realize that Adobe probably don't realize this, or simply don't have a heart to realize this by now. Adobe actually losing some valuable registered lifet
-
Using PCI-7344 and MID-7604 and FLEXMOTION. 3-Axis control, stepper motors, closed loop with optical linear encoders. 1) When I am stationary and command a Halt, there is a resulting jerk movement, sometimes up to a few 1000 servo steps. Why? 2) The
-
Dear All; We are using SRM7.0 with classic scenario i.e shopping cart is created in SRM and PO is triggered in SRM but created in ERP. Sometimes, the buyer gets a shopping cart with several lines. After negotiation with the supplier, he agrees (the s
-
Bootstrapping Error: ALC-TTN-105-000 under linux
As I deploied with Adobe LiveCycle Configuration Manager I got an error : ALC-TTN-105-000: Could not connect to bootstrap Servlet: Port [Connection refused] may be invalid I have checked with this command: netstat -an | find "8080. There was no servi
-
I am using wireless tool kit 2.1. I developed an api for accessing web services. It contains some packages with same name of some packages of sun's web service api. Sun's api is already included in the wirelsee tool kit. The problem is, When I run th