| 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( "jdbc dbc: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: 26496
|
|
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
|
 |
 |
|
|
subject: Insertion in MS EXCEL
|
|
|