aspose file tools*
The moose likes JDBC and the fly likes Insertion in MS EXCEL Big Moose Saloon
  Search | Java FAQ | Recent Topics | Flagged Topics | Hot Topics | Zero Replies
Register / Login
JavaRanch » Java Forums » Databases » JDBC
Bookmark "Insertion in MS EXCEL" Watch "Insertion in MS EXCEL" New topic
Author

Insertion in MS EXCEL

suraj sheikh
Greenhorn

Joined: Mar 07, 2008
Posts: 23
[code]
import java.io.*;
import java.sql.*;
public class MyExcel {
public static void main(String[] args) {
Connection connection = null;
String str="HELLO";
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
Connection con = DriverManager.getConnection( "jdbcdbc:MYDSN" );
Statement st=con.createStatement();
st.executeUpdate("INSERT INTO [Sheet1$] VALUES ('Suraj','sheikh')");
con.close();
} catch(Exception exec) {
exec.printStackTrace();
}
}
}
[/code/

The above code writes data only in the first column of every row, I want to write multiple colums in a single row

PLEASE HELP

Thanks in advance
Jeanne Boyarsky
internet detective
Marshal

Joined: May 26, 2003
Posts: 29241
    
139

Originally posted by suraj sheikh:
The above code writes data only in the first column of every row, I want to write multiple colums in a single row

How about using Java to figure out what values should go in each row and pass them to the select?


[Blog] [JavaRanch FAQ] [How To Ask Questions The Smart Way] [Book Promos]
Blogging on Certs: SCEA Part 1, Part 2 & 3, Core Spring 3, OCAJP, OCPJP beta, TOGAF part 1 and part 2
 
I agree. Here's the link: http://aspose.com/file-tools
 
subject: Insertion in MS EXCEL
 
Similar Threads
Problem Displaying JTable
TableModel-unable to locate error
Cell border colouring
limit result through JDBC
Jenny JDBC Code Generation