java菜鸟 提示是SQL语句错误,unknown column"sta_ID" in where clause,请问要怎么改

Class.forName("com.mysql.jdbc.Driver").newInstance();
Connection connection=DriverManager.getConnection("jdbc:mysql://localhost/members"+"?user=root&password=");
System.out.println("connected");
id_get = txtInput1.getText().trim();
String comm_data = "UPDATE customer1 SET cus_Name='" + txtInput2.getText().trim() + "',cus_Phone='" + txtInput3.getText().trim() + "',prtname='" + txtInput4.getText().trim() + "' WHERE "+"sta_ID='"+id_get+"'";
statement=connection.createStatement();
statement.executeUpdate(comm_data);

unknown column"sta_ID" in where clause

表示你的数据表的中的列名,对应不正确。唯一的方法,如下:

把此语句:

"UPDATE customer1 SET cus_Name='" + txtInput2.getText().trim() + "',cus_Phone='" + txtInput3.getText().trim() + "',prtname='" + txtInput4.getText().trim() + "' WHERE "+"sta_ID='"+id_get+"'";

sta_ID

与你的数据表中的列名,再核对一番。

温馨提示:答案为网友推荐,仅供参考
相似回答