Java 数据截断:截断的双精度值不正确
怎么了?如果我添加此列,将显示问题 参数索引超出范围(1>参数数量,为0)Java 数据截断:截断的双精度值不正确,java,mysql,Java,Mysql,怎么了?如果我添加此列,将显示问题 参数索引超出范围(1>参数数量,为0) 在更新方法中只绑定了四个参数。但是您的查询字符串包含五个。此外,您在查询中误用了和 查询应该是这样的,删除额外的和项 public static void KullaniciGuncelle(String ad, String soyad, String kadi, String sifre,String sorgu){ connection(); try { Connection connect = Dri
在更新方法中只绑定了四个参数。但是您的查询字符串包含五个。此外,您在查询中误用了
和
查询应该是这样的,删除额外的和项
public static void KullaniciGuncelle(String ad, String soyad, String kadi, String sifre,String sorgu){
connection();
try
{
Connection connect = DriverManager.getConnection(host, username , pass);
PreparedStatement statement = (PreparedStatement) connect.prepareStatement(sorgu);
statement.setString(1, ad);
statement.setString(2, soyad);
statement.setString(3, kadi);
statement.setString(4, sifre);
statement.executeUpdate();
statement.close();
connect.close();
}
catch(SQLException e)
{
e.printStackTrace();
}
对于第五个?
,更新方法需要额外的参数绑定。我猜idcalisan
是一个ID(尽管我不懂土耳其语,对不起),所以我建议setInt()
update table_name set col1='val1',col2='val2',。。。这里的col1='something'
不可能判断出哪里出了问题,因为我们不知道您的表中有什么,也不知道您调用getText()
的所有类。请澄清你的问题。您的查询中还有五个绑定参数?
,但只有四个参数加上要调用的DbConnection
方法的查询字符串。如果我使用“参数值问题:sw”,您认为这段代码是什么?DBConnection如果我使用额外的参数,KullaniciGuncelle方法需要创建新的文本框。
public static void KullaniciGuncelle(String ad, String soyad, String kadi, String sifre,String sorgu){
connection();
try
{
Connection connect = DriverManager.getConnection(host, username , pass);
PreparedStatement statement = (PreparedStatement) connect.prepareStatement(sorgu);
statement.setString(1, ad);
statement.setString(2, soyad);
statement.setString(3, kadi);
statement.setString(4, sifre);
statement.executeUpdate();
statement.close();
connect.close();
}
catch(SQLException e)
{
e.printStackTrace();
}
UPDATE calisan
SET CalisanAdi=?, CalisanSoyadi=?,
kul_adi=?, sifre=?
WHERE idcalisan=? ";
statement.setString(1, ad);
statement.setString(2, soyad);
statement.setString(3, kadi);
statement.setString(4, sifre);
statement.setInt (5, idcalisan)