老是报错!!The method PreparedStatement(String) is undefined for the type Connection

2024-12-23 00:39:56
推荐回答(3个)
回答1:

String sql="select myname ,myage from mypersons where 1=1";

或者
String sql="select myname ,myage from mypersons where myname =?";
PreparedStatement statement=connect.prepareStatement(sql);
statement.setString(1, "sss");
ResultSet results=statement.executeQuery();

回答2:

String sql = "select * from user where id = ?"
PrepatedStatement pstmt = connection.preparestatement(sql);
pstmt.setInt(1,id);

回答3:

你把代码贴出来看看