在做sql语句创建数据库时出现提示'@P0' 附近有语法错误。这是什么情况?
Stringsql="createdatabase?"+"on"+"(name='SI_dat',"+"filename='D:\\ffsfffff.mdf',"+"si...
String sql = "create database ? "+"on"+"(name='SI_dat',"+"filename='D:\\ffsfffff.mdf'," + "size= 10,"+"maxsize=50,"+"filegrowth=2)"+"log "+"on"+"(name='SI_log',"+"filename='D:\\ffsffff.ldf',"+"size=5mb,"+"maxsize= 25mb,"+"filegrowth=2mb)";
try {
// 建立SQL sever数据连接
pstmt = con.prepareStatement(sql);
pstmt.setString(1, servername);
pstmt = con.prepareStatement(sql);
pstmt.setString(1, servername);
System.out.println(sql);
pstmt.execute();
} catch (Exception e) {
e.printStackTrace();
}
已经搞定了,--!! 展开
try {
// 建立SQL sever数据连接
pstmt = con.prepareStatement(sql);
pstmt.setString(1, servername);
pstmt = con.prepareStatement(sql);
pstmt.setString(1, servername);
System.out.println(sql);
pstmt.execute();
} catch (Exception e) {
e.printStackTrace();
}
已经搞定了,--!! 展开
1个回答
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询
广告 您可能关注的内容 |