How can i gather data from jtable!
hi!
in fact i am trying to gather all the rowdata from my table sothat i can insert thel into my databse !
could you plkease tell me how to deal with this?
thanks
As a simple case, let's assume that your JTable's column header names are in the same order as the columns in the database table to which you want to insert the JTable data. Also, let's assume all your table values are Strings.
You'll need to do something like this (sorry if there are syntax errors - I'm not coding in an IDE...!):
String tempStr = "insert into table_name values (";
StringBuffer sb = null;
Statement stat = dbConnection.createStatement();
for (int i=0; i<tableModel.getRowCount(); i++) {
sb = new StringBuffer(tempStr);
for (int j=0; j<tableModel.getColumnCount()-1; j++) {
sb.concat("'").concat(tableModel.getValueAt(i, j)).concat("', ");
// for the last column
sb.concat("'").concat(tableModel.getValueAt(i, tableModel.getColumnCount()-1)).concat(");");
// your sb object now has the entire insert statement to put in the database
stat.executeQuery(sb.toString()) ;
}If the JTable columns are not in the same order, then you'll need to modify the above code to build your sql statement with the explicit column order you need.
I hope this helps.
Cheers!
Similar Messages
-
How can I modify data from a Transparent Table without ABAP code.
Hi,All
How can I modify data from a Transparent Table (like TCURR), and important thing is I want do all that with no ABAP code here. It is like that we always do that in a Oracle database use TOAD or PLSQL third party tools, with no script code here.
I had fond that there is a way can do that:
1, type 'se11',and Display Database table 'TCURR', click Contents, then click Execute to display all data
2, type '/h' and let debugging on
3, select one of this data then click 'Display',enter in debugging system.
4, then make a breakpoint in the code. But... display a dialog let I type a 'ABAP Cmnds', I want to know what can be type in for that?
and, My system is ECC6.
thank you all
Edited by: xuehui li on Aug 20, 2008 6:30 PMHello,
Your approach (with Vijay's suggestion) MAY work. However, depending on how tight security is at the company that you are working at you may or may not be able to acutaly change the value of the SHOW field to EDIT. This will be especially true if you are working in a Production environment. Vijay's other comment is true as well. This is not a recommended approach to change data (especially data with a financial impact like TCURR) in a production environment. The auditors will not be impressed.
Explore the option of a maintenace view or look at tcode TBDM to upload a file which includes daily rates from providers like Reuters or try tcode s_bce_68000174 which is a maintenance view on TCURR.
Regards
Greg Kern -
How can you transfer data from one ipod to another ?
How can you transfer data from one ipod to another ipod ?
The geniusbar told me what to do, I understood but there is still a problem for me >:/ It's not showing up though. Like "device." Nothing is happening, and I tried as soon as I got home. Then after half an hour, then an hour, then 3 hours. My problem is that it's not showing up! It's stuck in recovery mode! There's still like 25% battery. So I have no idea why.
-
How can I transport data from one client to another client?
How can I transport data from one client to another client?
Regards,
Subhohmmm, CTS = cutomizing transport?
If you have a customizing table, there are still two possibilities.
1. customize in DEV system and transport
2. customize right there where you need it.
this depends on how the maintainance view is built. If it is a simple customizing table and you get not asked for a TR when customizing a new record or changing an existing one, you hit possibility 2. -
How can I get Data from the Sound cart in Labview? Does a VI exist?
How can I get Data from the Sound cart in Labview? Does a VI exist?
Yes, there are VIs for acquiring data from Sound cards. And examples too. If you don't have LabVIEW yet, do a search on NI's site for example VIs.
Khalid -
How can i store data from a pc to TC
how can I backup data from a PC to TC
Get a suitable backup software..
Windows backup is of course useless. But you should already know that. It will not work on any version less than pro anyway.. due to MS deciding people with home versions should never use networks. ???
That is why there is one million and one third party backup software that do work with network drives. Look up reviews of what works well. for the price you want to pay and get it.. Drive Image was a popular one. I must have a copy somewhere I bought .. then changed to Mac..
There are plenty of free ones.. I do use macrium reflect.. does disk image only unless you pay the license.. but works super well.. particular for restore.. which people kind of forget.. the value of backup is how well does it restore.
Use ethernet if possible.
Note that mixing TM and data on the TC is not necessarily a great idea if you are also running Macs. -
How can i get data from another database SQL Server use database link from
I have a database link from Oracle connect to SQL Server database with user cdit connect default database NorthWind.How can I get data from another database(this database in this SQL Server use this database link)?
hi,
u should see following documentation:
Oracle9i Heterogeneous Connectivity Administrator's Guide
Release 1 (9.0.1)
Part Number A88789_01
in it u just go to chapter no. 4 (using the gateway),,u'll find ur answer there.
regards
umar -
How can I migrate data from an old MBA to a new one without having access to the screen of the old one? The screen of the old MBA is damaged !
If your "older" MBA has a Thunderbolt port then it isn't that old. See Target Disk Mode about how it's used. Note that without a monitor you won't be able to tell from the screen when it has fully started, and if it succeeded in starting in TDM. If it did, then the hard drive should appear on the Desktop of your new computer. You can then access it to transfer your files. You can even use Migration Assistant or any backup utility to transfer data. Just don't try to transfer system files.
-
How can i get data from a maintance view?
Hi all.
Can you give me some suggestion about 'How can i get data from a maintance view?'?
Thanks
Best regardhi
good
go through this link
http://help.sap.com/saphelp_nw04/helpdata/en/cf/21ecdf446011d189700000e8322d00/content.htm
thanks
mrutyun^ -
How can we post data from CRM to SAP using ABAP proxies???
Hi ,
Can anyone hep me to create interface for the following scenario How can we post data from CRM to SAP using ABAP proxies???, can I find any document ???????
Thanks in advance
AndyAndy,
Please look at these weblogs.
/people/ravikumar.allampallam/blog/2005/03/14/abap-proxies-in-xiclient-proxy
/people/ravikumar.allampallam/blog/2005/03/03/creating-purchase-order-idoc-through-xi
/people/siva.maranani/blog/2005/04/03/abap-server-proxies
/people/vijaya.kumari2/blog/2006/01/26/how-do-you-activate-abap-proxies
These should give a good idea about implementing Proxies.
Regards,
Ravi -
How can I migrate data from SQL Server 6,5 to Oracle 8?
We have a web site based on Microsoft SQL Server 6.5.Now we plan
to migrate the database to Oracle 8.
We have redesigned the tables structure and created tables under
Oracle 8, so we only need to migrate data from SQL Server.
We've exported data from SQL Server to text files.
How can we import data from files and restore to Oracle tables.
Is there a solution which let us to import data for particular
table columns,not all columns?
We'll be appreciated if somene can give suggestions.
Regards
Michael
nullThank you for your reply.
I'll try the Oracle sqlloader utility first.
Regards
Micahel
Oracle Migration Workbench Team wrote:
: Michael,
: Oracle sqlloader is user for this sort of operation, see
: Oracle8i Utilities
: Release 8.1.5
: A67792-01
: available online through Oracle Technology Network.
: The Oracle Migration Workbench can be used to create bcp and
: sqlloader scripts, though since you have altered the schema
these
: scripts would need to be altered by hand after generation.
: Some thought has been put into redesigning table structures in
: the Oracle Migration Workbench, but currently it looks like
this
: reengineering will be left to be done by other tools, eg
Oracle
: Designer, once the SQLServer database has been duplicated with
as
: little change as possible onto Oracle.
: Hope that helps,
: Turloch
: Oracle Migration Workbench Team
: Michael (guest) wrote:
: : We have a web site based on Microsoft SQL Server 6.5.Now we
: plan
: : to migrate the database to Oracle 8.
: : We have redesigned the tables structure and created tables
: under
: : Oracle 8, so we only need to migrate data from SQL Server.
: : We've exported data from SQL Server to text files.
: : How can we import data from files and restore to Oracle
tables.
: : Is there a solution which let us to import data for
particular
: : table columns,not all columns?
: : We'll be appreciated if somene can give suggestions.
: : Regards
: : Michael
: Oracle Technology Network
: http://technet.oracle.com
null -
How can i convert data from DBF to oracle database 10g?
Sir,
How can i convert data from DBF to oracle database 10g?I assume you at least know how to dump the contents of foxpro dbf file into CSV format.
Regarding SQL*Loader, hope this demo makes it a bit clear to you...
http://www.princeton.edu/~storacle/sqlloader_demo.shtml
I agree that it is an old web page (references Oracle 8.0.5) but basics remain the same.
If it is still unclear to you after referring above link, then get an Oracle consultant. -
How can i extract data from oracle table to flat file or excel spread shee
Hello,
DB Version is 10.1.0.3.0
How can i extract data from oracle table to flat file or excel spread sheet by using sub programs?
Regards,
DHere what I did
SET NEWPAGE 0
SET SPACE 0
SET LINESIZE 80
SET PAGESIZE 0
SET ECHO OFF
SET FEEDBACK OFF
SET VERIFY OFF
SET HEADING OFF
SET MARKUP HTML OFF SPOOL OFF
Sql> SPOOL bing
select * from -------;
SPOOL OFF;
I do not see file.
I also tried
Sql> SPOOL /tmp/bing
select * from -------;
SPOOL OFF;
But still not seeing the fie, -
How can get formatted data from hard drive
how can get formatted data from hard drive?
No chance without special tools/knowledge. There are companies that can do it, unless you use multiple format or rewrite data with special erase ustility or unless you have done low level format.
Regards
Milos -
Date sync: how can I sync dates from 2 cameras
hi
how can I sync dates from 2 cameras. From a wedding, my camera had the correct date, the borrowed one was about 11hrs out but not exactly. I want to change all the pics from the 2nd camera to sync with the first. I've already imported.
Many thanksUse "Metadata→Adjust date and time".
Instructions in the User Manual here. Not that the change is an offset to the time-stamp listed in the EXIF.
Message was edited by: Kirby Krieger
Maybe you are looking for
-
Firefox crashes on start up & only on my user and not other users on same computer
i have used firefox for many years thn all of a sudden i keep getting the crash reporter, so i can never try safe mode or other things because it crashes on strt up. Th strange thing is whn i log on to my wife user it works fine.
-
Coldfusion 11 Windows Server 2012 R2 Both the Coldfusion admin and additonal site work fine on HTTP. As soon as I attempt to enable SSL websockets and install SSL certs, the Coldfusion 11 Application service will not start. I followed the steps below
-
RCA to iphone cable question.
I'm looking for anyone who might have any advice on this item: http://cgi.ebay.com/ws/eBayISAPI.dll?ViewItem&ssPageName=STRK:MEWAX:IT&item=2703 23357361 I have aux input for my car's stereo and would like to use the cable for charger and stereo input
-
I have LR and PS via CC membership. I cannot find my CC desktop app in order to install updates?!?!
-
Problem with end-of-Quiz feedback...Captivate 5.5
I've created a short course with a quiz. At the end of the quiz, i would like to have the learner go to one of two slides (one for pass - the other for fail). From the "pass" slide, I would like them to click a button where a PDF certificate will o