早教吧作业答案频道 -->其他-->
Statementstmt=conn.createStatement();报错Typemismatch:cannotconvertfromjava.sql.Statementtojava.beans.Statement这个怎么解决啊?程序是packagefirst;importjava.beans.Statement;importjava.sql.Connection;importjava.sql.Driver
题目详情
Statement stmt=conn.createStatement();报错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 } }
▼优质解答
答案和解析
import java.sql.Statement;
看了 Statementstmt=...的网友还看了以下:
that was a statement 一个人说 great job 做得好然后另一个人说 th 2020-05-14 …
1.The second-hand car Jack bought was almost new; 2020-05-16 …
java的几道基础选择题222. Which statement is true about ha 2020-05-16 …
英语翻译come alongPlay with it while you have handsDu 2020-05-16 …
24 Sigma’s bank statement shows an overdrawn balan 2020-05-21 …
17 A business income statement for the year ended 2020-05-21 …
(ii) Comment on the figures in the statement prepa 2020-05-21 …
Which single access list statement will combine al 2020-05-31 …
Which statement accurately describes a benefit pro 2020-05-31 …
Statementstmt=conn.createStatement();报错Typemismat 2020-07-17 …