Populate List from Database (Very Strange Behaviour)
Dear Fellows,
I have developed a from which has two lists One for Major (say) and Other for Minor (say), thesr minors are based on the value of Major.
Now I have developed this system on Windows XP Professional, Developer/2000 6i and Oracle 8i (release 8.1.7).
Major list is populated from database and it shows all major values now using 'when_list_change' trigger the minor list is populated from the database based on the value of major list. Interestingly enough it is working fine without any problem.
Now I have deployed the software to Windows 2000 Professional/Server (tried on both), Developer/2000 6i and Oracle 8.0.5, but strangly the lists are not working now. First list (major) is still working but the other dependent lists are not working.
Another strange thing is that it populate the second list for one particular value (only at times).
The logic is that I have used a program unit to which i am passing 'list element' and 'query' and call it for each list in the when-list-change trigge.
Now its a very strange behaviour, I don't know what to do?
Your cooperation will be highly appreciated.
regards.
rolrollerx wrote:
Hi,
I have Nokia N8 (a great phone, btw) with Symbian Anna. I wanted to download the maps. But the PC Ovi Suite is just busy forever, without downloading anything (I used Performance Monitor to find out it was doing nothing for hours).
As I have unlimited data plan from my phone, I decided to try updating directly from the phone instead. It successfully downloaded the list of maps, but when I selected one of them
"No Wi-Fi network available. Please configure a WiFi access point in the phone Internet destination settings."
Why should I do that? I have a working connection on that phone (as evidenced by the successful download of the list of maps). So now, I am stuck. How can I download the maps?
Well, the suggestion is there. Use a router.
‡Thank you for hitting the Blue/Green Star button‡
N8-00 RM 596 V:111.030.0609; E71-1(05) RM 346 V: 500.21.009
Similar Messages
-
Very strange behaviour master-detail-detail please help
Very strange behaviour master-detail-detail please help
Hello,
I have a parent-child-grandchild report which show's some really strange behaviour.
The data template has 3 queries Q1, Q2 and Q3.
Q2 is bound to Q1 using a bind variable
Q3 is bound to Q2 using another bind variable
For a certain record in Q1 the output should be
2 records in Q2
and 1 record in Q3 for each record in Q2
Q1 record
Q2 record A
Q3 record AA
Q2 record B
Q3 record BC
The results conforms to the expected output.
For another record in Q1 the output should be
2 records in Q2
and 2 records in Q3 for each record in Q2
Q1 record
Q2 record A
Q3 record AA
Q3 record AB
Q2 record B
Q3 record BC
Q3 record BD
In stead of the expected output, the result shows
Q1 record
Q2 record A
Q3 record AA
Q3 record AB
Q2 record B
Q3 record AB
For another record in Q1 the output should be
5 records in Q2
and 2 records in Q3 for each record in Q2
Q1 record
Q2 record A
Q3 record AA
Q3 record AB
Q2 record B
Q3 record BC
Q3 record BD
Q2 record C
Q3 record CE
Q3 record CF
Q2 record D
Q3 record DG
Q3 record DH
Q2 record E
Q3 record EI
Q3 record EJ
In stead of the expected output, the result shows
Q1 record
Q2 record A
Q3 record AA
Q3 record AB
Q2 record B
Q3 record BC
Q3 record BD
Q2 record C
Q3 record CE
Q3 record CF
Q2 record D
Q3 record DG
Q3 record DH
Q2 record E
Q3 record DH
So for the last record of Q2 I don't get the appropriate records from Q3 when there are multiple records to be shown, but only the last record which belongs to the previous Q2
What is going on?
Please help me out...
Kind regards,
Jan-MarcelHi Tim,
Thanks for your reply. Below you will find the datatemplate on the scott/tiger schema.
Please help me out.
Kind regards,
Jan-Marcel
<dataTemplate name="scott" description="Template scott" dataSourceRef="otcy001" version="1.1">
<parameters>
<parameter name="p_deptno" dataType="number"/>
</parameters>
<dataQuery>
<sqlStatement name="Q1">
<![CDATA[
select empno mgr_empno
, ename mgr_name
, job mgr_job
, hiredate mgr_hiredate
, sal mgr_sal
, comm mgr_comm
from emp
where deptno = nvl(:p_deptno, deptno)
and mgr is null
]]>
</sqlStatement>
<sqlStatement name="Q2">
<![CDATA[
select empno mgr2_empno
, ename mgr2_name
, job mgr2_job
, hiredate mgr2_hiredate
, sal mgr2_sal
, comm mgr2_comm
, mgr mgr2_mgr
from emp
where mgr = :mgr_empno
]]>
</sqlStatement>
<sqlStatement name="Q3">
<![CDATA[
select empno emp_no
, ename emp_name
, job emp_job
, hiredate emp_hiredate
, sal emp_sal
, comm emp_comm
, mgr emp_mgr
from emp
where mgr = :mgr2_empno
]]>
</sqlStatement>
</dataQuery>
<dataStructure>
<group name="G_mgr1" source="Q1">
<element name="q1_mgr_empno" value="mgr_empno"/>
<element name="q1_mgr_name" value="mgr_name"/>
<element name="q1_mgr_job" value="mgr_job"/>
<element name="q1_mgr_hiredate" value="mgr_hiredate"/>
<element name="q1_mgr_sal" value="mgr_sal"/>
<element name="q1_mgr_comm" value="mgr_comm"/>
<group name="G_mgr2" source="Q2">
<element name="q2_mgr_empno" value="mgr2_empno"/>
<element name="q2_mgr_name" value="mgr2_name"/>
<element name="q2_mgr_job" value="mgr2_job"/>
<element name="q2_mgr_hiredate" value="mgr2_hiredate"/>
<element name="q2_mgr_sal" value="mgr2_sal"/>
<element name="q2_mgr_comm" value="mgr2_comm"/>
<element name="q2_mgr2_mgr" value="mgr2_mgr"/>
<group name="G_emp" source="Q3">
<element name="q3_emp_empno" value="emp_empno"/>
<element name="q3_emp_name" value="emp_name"/>
<element name="q3_emp_job" value="emp_job"/>
<element name="q3_emp_hiredate" value="emp_hiredate"/>
<element name="q3_emp_sal" value="emp_sal"/>
<element name="q3_emp_comm" value="emp_comm"/>
<element name="q3_emp_mgr" value="emp_mgr"/>
</group>
</group>
</group>
</dataStructure>
</dataTemplate> -
FOR i IN (statement) LOOP - very strange behaviour
Hello, I'm experiencing very strange behaviour in my 9i Development Environment:
If I run this select from SQL Plus a I get six month with number of days:
select to_char(add_months(trunc(sysdate,'month'),rownum-1),'Month-YYYY') tmp_date, add_months(trunc(sysdate,'month'),rownum)-add_months(trunc(sysdate,'month'),rownum-1) colspan from dual a connect by level <=6
But if I try to cycle through it in PL/SQL I only get the first row.
FOR i in (
select to_char(add_months(trunc(sysdate,'month'),rownum-1),'Month-YYYY') tmp_date, add_months(trunc(sysdate,'month'),rownum)-add_months(trunc(sysdate,'month'),rownum-1) colspan
from dual a
connect by level <=6 )
loop
-- print something out
end loop;
Any ideas why does this happen this way? If I use a query that does not contain CONNECT BY it works ok.Hi
Just change as given below:
FOR i in (
select * from (select to_char(add_months(trunc(sysdate,'month'),rownum-1),'Month-YYYY') tmp_date, add_months(trunc(sysdate,'month'),rownum)-add_months(trunc(sysdate,'month'),rownum-1) colspan
from dual a
connect by level <=6 ))
loop
-- print something out
end loop;
Regards
RK -
Very strange behaviour of RGBImageFilter class
Hi!
I found very strange behaviour of RGBImageFilter class and problem is
that I need to solve that problem :/ So, situation is next:
I decided to use filtering process for collecting information about
image. So, I extended my own class from RGBImageFilter and overwrite
filterRGB( ... ) method ( everything is absolutely the same as in
documentation ) and also added my own code for 'no matter what'.
This code changes some class variable and my idea was to read those
variables after filtering process end, but... Suddenly I realized that
those variables, many times changed while filtering were performed
( I checked it ) after filtering gave the same value as in constructor!
The only one clue and idea about what happened is that class instance
were cloned and then executed, but thats not a functionality I was
searching. :/ I made some example of that 'effect'.
Image file name goes in command line.
Please pay attention on -3 value on exit: Filtering works, count growing
( just uncomment setPixels() method to see it ) but, but...
import java.awt.*;
import java.awt.image.*;
import javax.swing.*;
class ToForum
public static void main( String[] args )
try
JFrame frame = new JFrame( "now i beleave in x-files!" );
frame.setDefaultCloseOperation( frame.DISPOSE_ON_CLOSE );
Toolkit kit = Toolkit.getDefaultToolkit();
Image origin = kit.getImage( args[0] );
RedBlueSwapFilter filter = new RedBlueSwapFilter();
Image filtered = frame.createImage( new FilteredImageSource( origin.getSource(), filter ) );
MediaTracker tracker = new MediaTracker( frame );
tracker.addImage( filtered, 1 );
tracker.waitForAll();
System.out.println( "AND WE GOT: "+filter.getCount()+" !!!" );
Container content = frame.getContentPane();
content.setLayout( new FlowLayout() );
JLabel label = new JLabel( new ImageIcon( filtered ) );
content.add( label );
frame.pack();
frame.setVisible( true );
catch( Exception ex )
System.out.println( "Exception in main():\n"+ex );
class RedBlueSwapFilter extends RGBImageFilter
private int count=-5;
public RedBlueSwapFilter()
count = -3;
canFilterIndexColorModel = true;
// uncommenting this function will show that filterRGB method IS calling !!!
// so, why then AFTER filtering count is still ( or again ??? ) equals to 0 ?
public void setPixels( int x, int y, int w, int h, ColorModel model, int pixels[], int off, int scansize )
System.out.println( "on entering in setPixels count="+count );
super.setPixels( x, y, w, h, model, pixels, off, scansize );
System.out.println( "on exiting from setPixels count="+count );
public int filterRGB( int x, int y, int rgb )
count++;
return ( (rgb&0xff00ff00) | ((rgb&0xff0000) >> 16) | ((rgb&0xff) << 16) );
public int getCount()
return count;Cliff, Hi. I'm curious because this can't work. I have no problem synching with the exchange - as long as i accept the message that the certificate of the exchange (which is not the certificate of the exchange but the certificate of dig @reighthandsideofmailadress) is not valid (expired, wrong common name etc).
-
Populate combobox2 From database WHERE combobox1.text = something
I want to populate combobox2 from database WHERE combobox1.text = something. Here is the code I have and also I am using datable so I want to keep it that way
private void cbCompany_SelectedIndexChanged(object sender, EventArgs e)
this.cmpLocationTableAdapter.FillLocbyCmp(this.shahiemsDataSet.cmpLocation, cbCompany.SelectedText.ToString());
cbLocation.DataSource = shahiemsDataSet.cmpLocation;The result is a blank combobox2(cbLocation).
Hello,
Did you mean that the combobox2 bound to the datatable cbLocation, but it didn't contain any item, right?
If so, it seems that the method FillLocbyCmp didn't fill any data to that datatable, to troubleshoot this case, we need to check the following tips.
1. Whether the database for that dataAdapter contains any data, and whether you connected to the right database.
2. Whether that database could get any result filtering by that text value.
3. Whether that method could get that datatable filt succeccfully.
Since we could not get code about that FillLocbyCmp method, if possible, you could share them with us.
Regards,
Carl
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Populate ComboBox from database - NOT using Flex Data Services
Hi there,
We are using CF with Flex but are not using the Flex Data
Service. I'm very much a newb and I'm having trouble finding any
information on how to populate controles from a database without
using Flex Data Service. Any help would be greatly appreciated.
First I have a page... JobSearch.mxml that contains a combo
box that I want to populate with the job_id and job_title from a
MSSQL database.
In Flex in the RDS DataView I used the "Create CFC" Wizard
which generated "job.cfc" and "jobGateway.cfc". It also generated
"job.as".
The CF Function that selects the data appears to be defaulted
and called "load" and the .as function is called simply "job".
So, that all looks great. But I can't find any information on
what I need to have on my JobSearch.mxml to actually get this data
into the comboBox.
I did:
<mx:Script>
<![CDATA[
[Bindable]
public var jobData:job = null;
]]>
</mx:Script>
And then:
<mx:ComboBox
text="{jobData.job_title}"></mx:ComboBox>
But I'm being told "Type was not found or was not a
complie-time constant: job"
I guess I'm missing something, or doing something way
wrong... I just don't know enough of Flex at this point to know
what it is.
Thanks!
AprilUsing php or asp is not an option, as we are a Cold Fusion
House.
I was looking at an article on Ben Forta's blog (
http://www.forta.com/blog/index.cfm?mode=e&entry=1786)
and following his example I did this... only it doesn't work:
I'm very very new to Flash and we are using ColdFusion but
are not using Flex Data Services. I've been trying to figure out
how to populate a combobox from a database and I'm just not having
any luck.
My project is called "PreTraffic". I have my main file as
"JobSearch.mxml" and a folder under the root named "cfc" with a
file called "job.cfc".
job.cfc contains the following code:
<cfcomponent>
<!--- Get jobs --->
<cffunction name="GetJob" access="remote"
returntype="query" output="false">
<cfset var job="">
<cfset var results="">
<cfquery datasource="discsdev" name="job">
SELECT job_id, job_title
FROM job
WHERE status = 'O'
ORDER BY job_title
</cfquery>
<cfquery dbtype="query" name="results">
SELECT job_title AS label, job_id AS data
FROM job
ORDER BY label
</cfquery>
<cfreturn results>
</cffunction>
</cfcomponent>
And JobSearch.mxml has the following code:
<?xml version="1.0" encoding="utf-8"?>
<mx:Application
xmlns:mx="
http://www.adobe.com/2006/mxml"
xmlns="*"
layout="absolute"
backgroundGradientColors="[#ffffff, #d0d0d0]"
creationComplete="InitApp()">
<mx:Style source="style.css" />
<mx:Script>
<![CDATA[
public function InitApp():void {
jobSvc.GetJob();
]]>
</mx:Script>
<!-- ColdFusion CFC (via AMF) -->
<mx:RemoteObject id="jobSvc" destination="PreTraffic"
showBusyCursor="true" />
<mx:VBox label="Job History" width="100%" height="100%"
x="10" y="92">
<mx:Label text="Search jobs by"/>
<mx:Form label="Task" width="100%">
<mx:FormItem label="Job Name:">
<mx:ComboBox id="jobNameCB"
dataProvider="{jobSvc.GetJob.results}"></mx:ComboBox>
</mx:FormItem>
</mx:Form>
<mx:HBox>
<mx:Button label="Search"/>
<mx:Button label="Clear"/>
</mx:HBox>
</mx:VBox>
</mx:Application>
My Compiler thingy points to:
-services
"/Volumes/flexwwwroot/WEB-INF/flex/job-services-config.xml" -locale
en_US
and job-services-config.xml contains the following code:
<destination id="PreTraffic">
<channels>
<channel ref="my-cfamf"/>
</channels>
<properties>
<source>flex.pretraffic.cfc.job</source>
<lowercase-keys>true</lowercase-keys>
</properties>
</destination>
Well, when I run the app... the combobox is not populated...
Can anyone help with what I've done wrong?
Thanks!
April -
Populate list from recordset on Parent/Child form
We have a parent/child form and want to populate several lists from recordsets. We can populate the child canvas by calling a procedure from the WHEN NEW FORM INSTANCE trigger but the same code fails when trying to populate a list on the Parent canvas. If I move the code to a PRE-BLOCK trigger on the parent block, then it works. I just kept moving the code until I found something that works. Can anyone tell me why it wouldn't work from the WHEN NEW FORM INSTANCE trigger? Is PRE-BLOCK the correct place?
WHEN-NEW-FORM-INSTANCE trigger
Add_Orgs_Lists('HR_PERSONS.OFFICE_SYMBOL');
PROGRAM UNIT
PROCEDURE Add_Orgs_Lists (list_name VARCHAR2) is list_id ITEM;
col_name VARCHAR2(80) := SUBSTR(list_name, INSTR(list_name, '.')+1);
sql_stat VARCHAR2(2000);
BEGIN
--Find ID for list item.
list_id := FIND_ITEM(list_name);
IF ID_NULL(list_ID) THEN
MESSAGE('List Item ' ||list_name|| ' does not exist.');
RAISE FORM_TRIGGER_FAILURE;
END IF;
--Build the SQL statement.
-- message('In Get_Org');
sql_stat := 'SELECT Distinct Org_Name, Org_Name FROM HR_Organizations
ORDER BY 1 ASC';
Populate_the_List(list_id, sql_stat);
EXCEPTION
WHEN OTHERS THEN
MESSAGE('Internal error occurred in Add_Orgs_List.');
RAISE FORM_TRIGGER_FAILURE;
END Add_Orgs_Lists;
PROCEDURE Populate_the_List (list_id ITEM,
sql_stat VARCHAR2) is
group_id RecordGroup;
outcome NUMBER;
--List_Elements VARCHAR2(40);
BEGIN
--message('In Populate_the...');
--Create temporary record group.
group_id := CREATE_GROUP_FROM_QUERY('List_Elements', sql_stat);
IF ID_NULL(group_id) THEN
MESSAGE('Record Group could not be created in Populate_the_List.');
RAISE FORM_TRIGGER_FAILURE;
END IF;
--Populate record group.
outcome := POPULATE_GROUP(group_id);
IF outcome <> 0 THEN
MESSAGE('Record Group could not be populated in Populate_the_List.');
RAISE FORM_TRIGGER_FAILURE;
END IF;
--Populate list item
POPULATE_LIST(list_id, group_id);
--Destroy the temporary record group to release resources
DELETE_GROUP(group_id);
EXCEPTION
WHEN OTHERS THEN
MESSAGE('Internal error occured in Popluate_the_List.');
RAISE FORM_TRIGGER_FAILURE;
END Populate_the_List;
The error is FRM-41337 Cannot populate the list from record group. It happens when we open the form. We are using the same code to populate the lists on the child form (except the SQL statement is different) and it works correctly.
I appreciate your help. -
Problem with dynamically loading the dropdown list from database
Please help me,
i am having a jsp page which contains a form
with a textfield ,two dropdown list
and a submit button
when i select a list from first drop down, second drop down has to
be loaded from the database dynamically according to the
selected one in the first drop down.
i gave onselect event for the first drop down and
gave this one
temp=first dropdown selected value
self.location='currentfile+query='+temp;
after this current page is reloading, but the already existing
values in textfield and first selected value in drop down list is
missing.
how to solve this problem? and the rest of the problem. i mean
loading the data into second drop down list.
plz help me......in first <selcet> tag write Onchange and submit to the jsp then the values will return in second select box.
-
Populate Datagrid from database
Using Adobe Flex Builder 3 Beta 2, I have successfully used
the Data Source Explorer window to connect to the Northwind and
Pubs database on my SQL 2005 server. I can see the schemas and
tables, etc. I understand that currently I cannot simply drag and
drop the fields into the datagrid (which would be nice) so how do I
'wire up' a table to the data grid? Is there an example which you
can refer me to (with source) that would explain that? I've
successfully wired up a webservice, but not to a database listed in
the Data Source Explorer. If there were an example that showed a
CRUD data grid, that would help.Just to give you an update as to where I am and where I'm
hung up, I was able to make a little bit of progress but not too
far.
1. I created a Flex Project (Web application) and specify
Applcation Server Type: ASP.net.
2. Next, I have the choice of specifying 'Use ASP .NET
Development Server' or 'Use Internet Information Services (IIS). At
the 'Usa ASP .NET Development Server', the error message at the top
of this wizard window says (X) You don't have ASP .NET Development
Server Installed. [Well, it may not be running but I do have it
installed as part of the .NET 2.0 Framework.. it does exist]. So,
because of the error, I have no choice but to use the alternate
option, 'Use Internet Information Services (IIS).
3. I specify my Web Application Root: d:\Flex3
Projects\TestProj3 (I manually have to create the folder).
4. I speciy my Web Application URL:
http://localhost
5. I click the Finish button.
Note... I've already selected my Connectivity using the Data
Source Explorer (which is available by selecting the following in
Flex Builder: Windows, Otherviews, Connectivity, Data Source
Explorer, and then adding in a database connection at my MS SQL
2005 server, specifying username and password).
6. Next, from Flex Builder, I select: Data, Create
Application from Database, and specify the current project,
connection (in my case, Northwind) and the employee table, etc. I
click NEXT.
7. I can select C# with web services or Visual Basic with Web
Services, so I select Visual Basic.
8. Select Finish.
OK at this point, a lot of code (action script, webservices,
etc. is auto-generated for me - kewl.. just like Dreamweaver :-)
Now I'm ready to run the application.
But wait - I know it won't run because I note that the ASP
.NET Development Server is not running. However - I can start it
from the windows command line.
First thing I do is stop my local IIS server which is using
Port 80.
Next thing I do is open a windows command line and navigate
to my .Net 2.0 Framework directory:
cd \WINDOWS\Microsoft.NET\Framework\v2.0.50727
and then I run the ASP .NET Web server at the same path that
my application (above) is written to (again, typed in the command
line window).
start /b webdev.webserver /port:80 /path:"D:\Flex3
Projects\TestProj3\bin"
Finally, from the Flex Builder window, I right-click on the
auto-build Employee.mxml table and select 'Run application'.
After a few moments an Internet Explorer window comes up. I
believe it says:
http://localhost/bin/Employees.html
and I change it to read:
http://localhost/Employees.html
and it runs.. well it runs, but with 'An unexpected error
occured and it has been logged.'
So that's as far as I have gotten but it does write the code.
So am I to assume that whether I do this by hand or use the
'auto-generated code' that I will be using WebServices to read and
write from the MS SQL 2005 database?
I would much rather my Flex Application open a connection to
the database directly and send SQL statements. I'm guessing that
might not be possible without some driver? Perhaps thats were Adobe
Live Cycle comes in?
Any insight (frm anyone) would be helpful. Thank you. -
Populating Web List from database Based on Selected Field
Hi,
I'm really new to this so pardon my ignorance on the following.
At my company, we have developed a web site using Oracle
Application Server using PL*SQL cartridge, i.e. all the
rendering of forms and processing of data are done using PL*Sql
commands.
I have a list field where I'd like the values populated from the
database using a value specified by a user in another field.
Example:
State ____ City ____________________
When user selects a state, I'd like to be able to dynamically
populate the city field with values from the database.
Does anyone have an example of how to do this? I'm guessing it
can be done using thin JDBC.
Any help would be appreciated.
Thanks
J Mathew
nullHi Ram
for the first time when the page loads i want the trailing list to be empty ....
so in the processRequest itself i call invokeMethod and append the whereclause in the voImpl .....if a do a System.out.println("Trailing List VO ::ROW COUNT IS : "+getRowCount()); immediately after executeQuery it returns 0 ...
but some how on the page i get to see some records in the list....
Let me know if anyother info is required ...
Regards
Sunny -
Very strange behaviour of SqlDataReader on wifi connection.
Hi Experts,
We are doing performance test on filling data from SQL to list using following link
http://www.codeproject.com/Articles/14760/A-Custom-Business-Objects-Helper-Class ( reflection) with static class filling using sqldatareader as data provider.
We found the if application + database are on same server we get 80% of performance over reflection
if application +database are on different server we get 60% of performance over reflection when connected via LAN.
if application +database are on different server we get -0.21 of performance over reflection when connected via WIFI.
Can any one please explain why wifi connection behaves weirdly.Hello
luckyforu2006,
According to your description, your case related to data provider, so i moved your case to
Data Platform Development >ADO.NET Managed Providers
forum for better support.
Have a ncie day!
Kristin
We are trying to better understand customer views on social support experience, so your participation in this interview project would be greatly appreciated if you have time. Thanks for helping make community forums a great place.
Click
HERE to participate the survey. -
Populate Array from Database!
I have this working manually, but please need help creating this from a DB Connection and populating the Array with the results.
I just need help with populating "DestinationItem[]" from the SQL below
DestinationBean.java
// Manual Array works but I need this to be populated from DB using the below Query and DB Connection info.
private DestinationItem[] destinationResults = new DestinationItem[]{
new DestinationItem("58285", "Dodge Grand Caravan"),
new DestinationItem("57605", "Dodge SX 2.0"),
new DestinationItem("58265", "Chrysler 300 Touring")
public DestinationItem[] getdestinationResults() {
return destinationResults;
public class DestinationItem {
String destid;
String commdefid;
public DestinationItem(String destid, String commdefid) {
this.destid = destid;
this.commdefid = commdefid;
// Getter/Setter below
// END
I need to take this DB Connection Logic and populate the "DestinationItem[]" Array above and I need help.
//DBConnection
public static ArrayList<CustomerBean> getCustomer() {
try {
Class.forName("oracle.jdbc.OracleDriver").newInstance();
Connection con = DriverManager.getConnection("jdbc:oracle:thin:", "BLAH", "BLAH");
PreparedStatement ps = con.prepareStatement("select destination_id, commdef_id from BLAH.destination");
ArrayList<CustomerBean> al = new ArrayList<CustomerBean>();
ResultSet rs = ps.executeQuery();
boolean found = false;
while (rs.next()) {
CustomerBean e = new CustomerBean();
e.setDestId(rs.getString("destination_id"));
e.setDestId(rs.getString("commdef_id"));
al.add(e);
found = true;
rs.close();
if (found) {
return al;
} else {
return null; // no entires found
} catch (Exception e) {
System.out.println("Error In getCustomer() -->" + e.getMessage());
return (null);I have this working manually, but please need help creating this from a DB Connection and populating the Array with the results.
What does 'working manually' mean?
What PROBLEM are you having? The code you posted appears to ALREADY populate an ArrayList with the results.
I just need help with populating "DestinationItem[]" from the SQL below
Are you asking how to convert the ArrayList returned by the'getCustomer' method into an array?
Just use the 'toArray' method of ArrayList. See the Java API
ArrayList (Java Platform SE 7 )
public Object[] toArray()
Returns an array containing all of the elements in this list in proper sequence (from first to last element).
The returned array will be "safe" in that no references to it are maintained by this list. (In other words, this method must allocate a new array). The caller is thus free to modify the returned array.
This method acts as bridge between array-based and collection-based APIs.
Why do you have one class named DestinationBean' and another one just like it named 'CustomerBean'?
I need to take this DB Connection Logic and populate the "DestinationItem[]" Array above and I need help.
What is it you need help with?
The 'getCustomer' method ALREADY populates an ArrayList. So just convert the ArrayList to an array using 'toArray'.
public static ArrayList<CustomerBean> getCustomer() {
I don't understand what problem you are having.
Class.forName("oracle.jdbc.OracleDriver").newInstance();
Remove that line - that hasn't been used for years.
boolean found = false;
Remove that code and ALL references to 'found'. You created an empty ArrayList when you started. If it is still empty when you are done then there are NO results. Just return an empty array (preferable).
Let the caller handle an empty ArrayList.
You already have code that appears to get a collection of items.
Explain EXACTLY what your problem is. Why can't you just use the code you posted? -
I have a code that populates Combo box from a db and its ok. however, the items are displayed enclosed in brackets i.e. instead of seeing
Coptic Hospital
i see
[Coptic Hospital]
i dont want to see the brackets. here's the code
public void getSp(){
String query="SELECT Provider FROM `smartmain`.`providers` p ";
JDataBase db=new JDataBase();
providers=db.getData(query);
for(int i=0;i<providers.size();i++){
ComboSp.addItem(providers.elementAt(i));
}getData is a function in JDataBase class.
public Vector getData(String query) {
int no_rows=0;
if (connection == null || statement == null) {
System.err.println("There is no database to execute the query.");
return new Vector();
try {
resultSet = statement.executeQuery(query);
metaData = resultSet.getMetaData();
int numberOfColumns = metaData.getColumnCount();
columnNames = new String[numberOfColumns];
// Get the column names and cache them.
// Then we can close the connection.
for(int column = 0; column < numberOfColumns; column++) {
columnNames[column] = metaData.getColumnLabel(column+1);
// Get all rows.
rows = new Vector();
while (resultSet.next()) {
no_rows++;
Vector newRow = new Vector();
for (int i = 1; i <= numberOfColumns; i++) {
newRow.addElement(resultSet.getObject(i));
rows.addElement(newRow);
catch (SQLException ex) {
System.out.println(query);
System.err.println(ex);
return rows;
}how should i remove them?Your getData() function is returning a Vector of Vectors, so you are adding a Vector to your combo box model. A Vector's toString() method will return its contents in [] brackets.
-
How to populate values from database into a Combo Box?
Hi,
How to display all the values of a field of a database table in a combo box inside a grid in B1 user defined form?
Regards,
Sudeshna.Hi,
If you are trying to do this on a system form (I gues this is your case, reading the other question), for example Sales Orders, and you want to show the values from a User Defined Table (UDT), you just need to add a User Defined Field on Marketing Documents Line level, and say it is linked to the UDT.
SBO will automatically show the combo with the values on the Code field of the UDT.
Regards,
Ibai Peña
Sorry, I didn´t read the post well.
What you could do is each time the form is loaded, read the values from the table, and asign them as Valid Values for the combobox column. You can do this programatically, or using XML (which is recommended becouse of better performance).
Message was edited by: Ibai Peña -
My iphone has some very strange behaviour
I am running a stock iPhone 5, not jailbroken, iOS 7.0.6. The other day, one of my appliation folders kept opening when I wasn't touching the screen. Every time I would close the folder, it would re-open by itself.
Today I unlocked the phone and before I had opened any apps, Safari opened by itself and the words "buu's fury" got typed into the address bar and came up with a Google search.
I keep hearing that iPhone's don't get viruses, any ideas what could be causing this?
ThanksYou hear correct there's no virus & malware that can run on iPhone.
Double tab Home button and delete Safari from multitask-list.
Clear Safari history cookies & data.
Settings > Safari > here
Do not track: ON
Fraudulent Website Warning: ON
Do a
Reset: Hold down the Sleep/Wake button and the Home button at the same time for at least ten seconds, until the Apple logo appears. Note: You will not lose any data
Maybe you are looking for
-
One of my computers crashed and I lost all my itunes library. how do I get this back?
My daughter accidentally downloaded a virus and my computer crashed hard along with the back up hard drive! I was able to recover just a few item using all the data retrieval software but 90% of my stuff is gone or corrupted including all my itunes
-
Oracle 9i Client Installation for Windows Server 2003
Hello All, How do I install the 9i client on Win Server 2003? I can't find any instructions... Is it just download the 2 files and install in that order? http://www.oracle.com/technology/software/products/oracle9i/htdocs/win2k3soft.html Thanks! Messa
-
Hello!!! I need help with transaction PR05, when creating a request of travel expenses with foretaste in US currency I get this error: <b>error: Advance 30,00 is not in foreign currency; payment currency changed to VEB</b>. I dont want the transacti
-
Clearing of Additional Amounts and Income-Related Expenses
Dear colleagues, Can anyone, please, give me a practical example for such configuration? What does SAP understand under income-related expenses and what kind of clearing will be processed? Many thanks, Paulo
-
I have a 160 GB iPod Classic and plan to add a 64 GB iPod Touch. My iTunes libraries have over 70 GB. Can I have 2 different settings for syncing the 2 iPods? Automatically for the Classic and manual for the Touch.