Statement stmt=conn.createStatement();报错
Typemismatch:cannotconvertfromjava.sql.Statementtojava.beans.Statement这个怎么解决啊?程序是pack...
Type mismatch: cannot convert from java.sql.Statement to java.beans.Statement
这个怎么解决啊?程序是
package first;
import java.beans.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
public class JDBCtest1
{
public static void main(String[] args)
{
Class .forName("com.mysql.jdbc.Driver");
Connection conn=
DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbc","root","admin");
Statement stmt=conn.createStatement();
String sql="insert into student values(1,'Tom',21)";
int row=stmt.executeUpdata(sql);
System.out.println("数据库中更新了"+row+"条数据");
stmt.close();
conn.close();
}
catch (Exception e) {
System.out.prlntln("数据库操作过程发生异常");
// TODO: handle exception
}
}
int row=stmt.executeUpdata(sql);这行也报错 展开
这个怎么解决啊?程序是
package first;
import java.beans.Statement;
import java.sql.Connection;
import java.sql.DriverManager;
public class JDBCtest1
{
public static void main(String[] args)
{
Class .forName("com.mysql.jdbc.Driver");
Connection conn=
DriverManager.getConnection("jdbc:mysql://localhost:3306/jdbc","root","admin");
Statement stmt=conn.createStatement();
String sql="insert into student values(1,'Tom',21)";
int row=stmt.executeUpdata(sql);
System.out.println("数据库中更新了"+row+"条数据");
stmt.close();
conn.close();
}
catch (Exception e) {
System.out.prlntln("数据库操作过程发生异常");
// TODO: handle exception
}
}
int row=stmt.executeUpdata(sql);这行也报错 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询