Give you an example:
import java.sql.*;
import java.awt.*;public class Createexp {
public static void main(String args[]){
String url = "jdbc:odbc:wwms"; ///wwms is the data source of ODBC
Connection con = null;
Statement sm = null;try{///Load JDBC-ODBC driver bridge
Class.forName("sun.jdbc.odbc.JdbcOdbcDriver");
//com.ms.jdbc.odbc.JdbcOdbcDriver /// Wrong, change com.ms to sun
} catch(Exception e){
System.out.println ("Unable to load JDBC-ODBC bridge driver"); return;}/////Establish a connection with the database and display try{con = DriverManager.getConnection(url);
sm = con.createStatement(); //Create object
//Execute the creation operation of database table
sm.execute("create table tb(tepno int, tepname char(10) )");sm.close();
import java.util.ArrayList;
import java.util.List;
public class ListDemo {
public static void main(String[] args) {
int numLength = 10;
int deleteNum = 5;
List
init(numLength,list);
delete(deleteNum,list);
print(list);
}
private static void print(List
for(int i=0;i System.out.print(list.get(i) "\t"); } } private static void delete(int deleteNum,List for (int i=0;i if((int)list.get(i)==deleteNum){ list.remove(i); } } } private static void init(int numLength,List for(int i=1;i
list.add(i); } } } //Of course it would be better if you post your code. It can help you find the problem. In addition, you can also know how much you know about Java. The help you give may be more practical. HSSFWorkbook wb=new HSSFWorkbook(); //Create an Excel HSSFSheet sheet=wb.createSheet("sheet1");//Create a Sheet HSSFRow row=sheet.createRow(0);//Create a row HSSFCell cell=row.createCell((short)0); //Create a cell cell.setEncoding(HSSFCell.ENCODING_UTF_16); cell.setCellValue("serial number"); //Set the value cell=row.createCell((short)1); cell.setEncoding(HSSFCell.ENCODING_UTF_16); cell.setCellValue("surname");How to add an excel table when developing software with java
The above is the detailed content of Write code using JAVA to create a table. For more information, please follow other related articles on the PHP Chinese website!