Hi........ to all
I hav created the table in the applet window using JTable... i hav to store the retrived data from database in the table..consider if the table contains 3rows i hav insert all the 3 rows ..... Is it possible... if so.. can u explain me..how.....
Regards
Pradeep
4 1284
Hi........ to all
I hav created the table in the applet window using JTable... i hav to store the retrived data from database in the table..consider if the table contains 3rows i hav insert all the 3 rows ..... Is it possible... if so.. can u explain me..how.....
Regards
Pradeep
Of course it's possible. When the saved button is clicked, just execute an insert statement.
Of course it's possible. When the saved button is clicked, just execute an insert statement.
Thanks..
can u explain with a small example .....
Regards
Pradeep
Thanks..
can u explain with a small example .....
Regards
Pradeep
What do you have so far?
What do you have so far?
Sorry sir.. yesterday due to network problem.. i can't able to continue the discussion...... i hav to insert data into the table....
consider if the database contains 3 rows.. i hav to insert all the three rows...
can u say how to get all the rows.. from the database.. - import java.io.*;
-
import java.sql.*;
-
import java.awt.*;
-
import java.awt.event.*;
-
import sun.jdbc.odbc.*;
-
import javax.swing.*;
-
-
public class Tab extends Frame implements ActionListener
-
{
-
JTable table;
-
Label l1;
-
Button view,exit;
-
Connection con;
-
ResultSet rs;
-
Statement stmt;
-
String s,M;
-
public Tab()
-
-
{
-
super("Table");
-
setSize(700,700);
-
setLayout(null);
-
setBackground(new java.awt.Color(245, 117, 105));
-
-
table = new JTable(7,8);
-
l1=new Label("TABLE");
-
l1.setBounds(20,60,100,70);
-
table.setBounds(30,180,650,114);
-
exit= new Button("Exit");
-
exit.addActionListener(this);
-
exit.setBounds(360,580,100,40);
-
-
-
add(l1);
-
add(table);
-
add(exit);
-
setVisible(true);
-
-
-
-
addWindowListener(new WindowAdapter(){
-
public void WindowClosing(WindowEvent w) {System.exit(0);}});
-
}
-
-
-
-
public void actionPerformed(ActionEvent ae)
-
{
-
int flag=0;
-
if(ae.getSource()==view)
-
{
-
-
try
-
{
-
-
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
-
con=DriverManager.getConnection("jdbc:odbc:prism");
-
stmt=con.createStatement();
-
rs=stmt.executeQuery("select * from Melting");
-
-
- while(rs.next())
-
{
-
-
s=(rs.getString(1));
-
-
}
-
}
-
catch(ClassNotFoundException e)
-
{
-
System.out.println(e);
-
}
-
catch(SQLException e)
-
{
-
System.out.println(e);
-
}
-
}
-
if(ae.getSource()==exit)
-
{
-
System.exit(0);
-
}
-
}
-
public static void main(String args[])
-
{
-
-
Tab pu=new Tab();
-
}
-
}
Sign in to post your reply or Sign up for a free account.
Similar topics
by: Ben Munday |
last post by:
Hi all,
I have a problem with a Checkbox in a JTable.
When i add the Checkbox into the JTable it displays the String
representation of the Checkbox, which is not what i want.
So, i created a...
|
by: asd |
last post by:
I need to make the cells in the 1st column look like the column
header. I tried the following code but it didn't change anything:
private void rendererTest()
{
TableColumn column =...
|
by: raysaun |
last post by:
I am trying to set a TableCellEditor for a JTable, however,
the editor never seems to get called. I can not even get
a simplified version (below) to work. When I put a breakpoint on the
return...
|
by: sivaprasad06 |
last post by:
Hi,
I have a editable combo box editor as a cell editor for JTable.
I want use only key board to enter data into jtable. so i am using
ALT+Down comobination for making cell editiable in the...
|
by: moizpalitanawala |
last post by:
Hello friends,
How to add data to JTable from a .txt file.
I had seen this code from one of the tutorial from java.com. This code doesnt take any input. But shows what is written in the array....
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
by: BarryA |
last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
by: Sonnysonu |
last post by:
This is the data of csv file
1 2 3
1 2 3
1 2 3
1 2 3
2 3
2 3
3
the lengths should be different i have to store the data by column-wise with in the specific length.
suppose the i have to...
|
by: Hystou |
last post by:
There are some requirements for setting up RAID:
1. The motherboard and BIOS support RAID configuration.
2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
|
by: marktang |
last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
|
by: Hystou |
last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
| |