• Post Reply Bookmark Topic Watch Topic
  • New Topic

Insertion in MS EXCEL  RSS feed

 
suraj sheikh
Greenhorn
Posts: 23
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
[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
author & internet detective
Marshal
Posts: 37181
515
Eclipse IDE Java VI Editor
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
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?
 
It is sorta covered in the JavaRanch Style Guide.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!