Hi all,
I am doing a DSN-Less connection to a user defined .XLS spreadsheet.
As coded, my users must call the first sheet of their Excel spreadsheet
"sheet1"
for me to successfully read their spreadsheet.
Can anyone tell me how to "SELECT * FROM [???]" no matter what the user
calls their first sheet?
try {
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
String myDB = "jdbc:odbc:Driver={Microsoft Excel Driver
(*.xls)};DBQ="c:\\list.xls";DriverID=790;READONLY=false";
conn = DriverManager.getConnection(myDB,"","");
Statement stmt =
conn.createStatement(ResultSet.TYPE_SCROLL_INSENSITIVE,
ResultSet.CONCUR_READ_ONLY);
ResultSet rs = stmt.executeQuery("SELECT * FROM [sheet1$]");
rs.last();
count = String.valueOf(rs.getRow()).toString();
rs.beforeFirst();
stmt.close();
done(conn);
}
catch (ClassNotFoundException cnf){
cnf.printStackTrace();
}
catch (SQLException se) {
se.printStackTrace();
}
Thanks in advance for your assistance!
Mike Cronin
___________________________________________________________________________
To unsubscribe, send email to [EMAIL PROTECTED] and include in the body
of the message "signoff SERVLET-INTEREST".
Archives: http://archives.java.sun.com/archives/servlet-interest.html
Resources: http://java.sun.com/products/servlet/external-resources.html
LISTSERV Help: http://www.lsoft.com/manuals/user/user.html