把建表sql写入存储过程~~然后程序中调用也是可以的啊
解决方案 »
- 将jsp中table里的数据导出到excel中
- 问个JDBC批量更新的问题
- JBuilder 读文件
- 快来帮帮我啊!java.sql.SQLException: Io 异常: The Network Adapter could not establish the connection
- getClass().getResource("/").getPath() 路径
- 关于button按纽的问题
- 乱码问题请教!
- asp中有server.encodeHTML(),jdk中有没有类似的?
- 如何将多表查询到的结果显示到JSP界面中
- 在jsp页面里怎么来循环出多个表
- <logic equal >
- J2EE中DAO设计问题
然後在Java程序中調用這個函數。
String tablename = "tablename";//表名
String sql = " use" + basename+" creat table "+tablename
+"(表字段名1,表字段名2,表字段名3,表字段名...)";
boolean iscreat = CreatTable(sql);
if(iscreat){
out.println("数据表创建成功!");
}else{
out.println("数据表创建失败!");
}
1.你可以定义一个String类型的sql语句,里面是具体创建表的sql语句,
你再用StateMent语句执行executeUpdate(sql)方法2.你也可以用PreparedStatement来创建(其实它是Statement的子类)3.也可以把你写的sql放进存储过程来执行