自定义博客皮肤VIP专享

*博客头图:

格式为PNG、JPG,宽度*高度大于1920*100像素,不超过2MB,主视觉建议放在右侧,请参照线上博客头图

请上传大于1920*100像素的图片!

博客底图:

图片格式为PNG、JPG,不超过1MB,可上下左右平铺至整个背景

栏目图:

图片格式为PNG、JPG,图片宽度*高度为300*38像素,不超过0.5MB

主标题颜色:

RGB颜色,例如:#AFAFAF

Hover:

RGB颜色,例如:#AFAFAF

副标题颜色:

RGB颜色,例如:#AFAFAF

自定义博客皮肤

-+
  • 博客(0)
  • 资源 (3)
  • 收藏
  • 关注

空空如也

ojdbc6_驱动.rar

版本号 11.2.0.3 文件全名 ojdbc6-11.2.0.3.jar 下载后自己改个名字把,亲测可用

2019-12-02

带贴图的blend格式宝剑.rar

带贴图的blend格式宝剑,忘记贴图了,自己去贴 图片素材有。

2014-01-02

java解析excel到mysql代码存档.txt

package importEx; import java.io.File; import java.io.FileInputStream; import java.io.InputStream; import java.io.IOException; import java.sql.Connection; import java.sql.DriverManager; import java.sql.PreparedStatement; import jxl.Cell; import jxl.Sheet; import jxl.Workbook; import jxl.read.biff.BiffException; public class ImportExcelTest { /** * * 只能插入单选题和多选题 * * @param args * @throws BiffException * @throws IOException */ public static void main(String[] args) throws BiffException, IOException { //文件路径 InputStream is=new FileInputStream("d:\\c.xls"); try { Class.forName("com.mysql.jdbc.Driver").newInstance(); Connection conn = DriverManager.getConnection("jdbc:mysql://127.0.0.1:3306/exam", "root", "aaaaaa"); PreparedStatement prep = conn.prepareStatement("insert into t_exam_question values (null,null,null,?,null,?,?,?,?,?,?,?,?,?,?,null,null)"); Workbook wb = Workbook.getWorkbook(is); Sheet sheet = wb.getSheet(0); //第几张表格 从零开始 String sheetName = sheet.getName(); System.out.println("sheet表名(工作薄名): "+sheetName); String question_content = ""; //题目内容 String question_type= ""; //题目类型 //用来得到单元格的内容 String choice_A = ""; //A String choice_B=""; //B String choice_C=""; //C String choice_D=""; //D String choice_E=""; //E String choice_F=""; //F String difficulty =""; //难度 String answer=""; //答案 String knowledge_type=""; //知识结构 if(sheet!=null) { // 获取表格总列数 int rsColumns = sheet.getColumns(); System.out.println("表格总列数rsColumns = " + rsColumns); // 获取表格总行数 int rsRows = sheet.getRows(); System.out.println("表格总行数 rsRows = " + rsRows); for(int rowNum = 1;rowNum <rsRows;rowNum++){ Cell[] cells=sheet.getRow(rowNum); //这里就是对每一个列来获取,cells就是把这一行的某一列赋值给你所要操作的值. question_content = cells[0].getContents(); difficulty = cells[8].getContents(); knowledge_type = cells[9].getContents(); choice_A = cells[1].getContents(); choice_B = cells[2].getContents(); choice_C = cells[3].getContents(); choice_D = cells[4].getContents(); choice_E = cells[5].getContents(); choice_F = cells[6].getContents(); answer = cells[7].getContents(); prep.setString(1, question_content); prep.setInt(2, Integer.parseInt(sheetName)); prep.setInt(3, Integer.parseInt(difficulty)); prep.setInt(4, Integer.parseInt(knowledge_type)); prep.setString(5, choice_A); prep.setString(6, choice_B); prep.setString(7, choice_C); prep.setString(8, choice_D); prep.setString(9, choice_E); prep.setString(10, choice_F); prep.setString(11, answer); prep.executeUpdate(); System.out.println("------------------第 "+rowNum+" 条记录"); } } prep.close(); conn.close(); wb.close(); } catch (Exception e) { e.printStackTrace(); System.out.println("数据插入完成!!!程序终止!!!"); } } }

2010-10-21

空空如也

TA创建的收藏夹 TA关注的收藏夹

TA关注的人

提示
确定要删除当前文章?
取消 删除