• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Liutauras Vilda
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Sheriffs:
  • Tim Cooke
  • Knute Snortum
  • Bear Bibeault
Saloon Keepers:
  • Ron McLeod
  • Tim Moores
  • Stephan van Hulst
  • Piet Souris
  • Ganesh Patekar
Bartenders:
  • Frits Walraven
  • Carey Brown
  • Tim Holloway

Insertion in MS EXCEL

 
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( "jdbc:odbc: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
 
author & internet detective
Posts: 39343
755
Eclipse IDE VI Editor Java
  • 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?
 
Don't get me started about those stupid light bulbs.
  • Post Reply Bookmark Topic Watch Topic
  • New Topic
Boost this thread!