Hi,
ich bekomm n fehler bei einer abfrage:
Fehler in Abfrage: java.sql.SQLException: [CA][Ingres ODBC Driver][Ingres]line 1, You cannot assign a value of type 'varchar' to a column of type 'integer'. Explicitly convert the value to the required type.
aber des kann eigentlich net sein. des sind alles Strings, bis auf vier ausnahmen. des sind ints. und alle richtig zugewiesen.
er holt mir auch alles schön aus der db raus. nur reinschreiben mag er net. da kommt der fehler.
hier mal code ...
in Station, etc. steht nach drücken des buttons null.
Dank schön.is bestimmt nur n plöder fehler den ich jetzt nimmer seh ...
ich bekomm n fehler bei einer abfrage:
Fehler in Abfrage: java.sql.SQLException: [CA][Ingres ODBC Driver][Ingres]line 1, You cannot assign a value of type 'varchar' to a column of type 'integer'. Explicitly convert the value to the required type.
aber des kann eigentlich net sein. des sind alles Strings, bis auf vier ausnahmen. des sind ints. und alle richtig zugewiesen.
er holt mir auch alles schön aus der db raus. nur reinschreiben mag er net. da kommt der fehler.
hier mal code ...
Code:
...
//Tafel aktualisieren
tafel_aktual.addActionListener(new ActionListener()
{
public void actionPerformed(ActionEvent e)
{
int b = Integer.parseInt(dbfrids.getRowCount());
try
{
//KreissaalPat[] pats = new KreissaalPat[b];
for (int i=0; i<b; i++)
{
dbfrids.insertKrsTable();
}
table.repaint();
}
catch(Exception ex)
{
String a = "Fehler bei update";
}
}
});
...
Code:
...
public void insertKrsTable()
{
KreissaalPat[] patienten= new KreissaalPat[100];
int i=0;
Statement query = null;
ResultSet daten = null;
String sql = "insert into krstafel2 " +
"values( " + Station + ", " + Name + ", '" + P_ + "'," +
ET + ", " + SSW + ", " + G + ", " + P + ", '" + F + "', '" +
Lage + "', '" + Diagnose + "', '" + Therapie + "', '" + v +
", " + v + ", " + CTG + ", " + Pädiater_informiert+ ", '" + AN_Aufklärung
+ "', '" +"') "+
"Where station = " + Station + "and name = " + Name + "and privat = " +
P_ + "and et = "+ ET + "and ssw = " + SSW + "and gravida = " + G +
"and para = " + P + "and foeten = " + F + "kindslage = " + Lage +
"and diag = " + Diagnose + "and ther = " + Therapie + "and lila = " +
v + "and ctg_ges = " + CTG + "and paedinf = " + Pädiater_informiert +
"and anauf = " + AN_Aufklärung;
try
{
query = db.createStatement();
daten = query.executeQuery(sql);
while(daten.next())
{
patienten[i] = new KreissaalPat(Station, Name, P_, ET, SSW, G, P, F,
Lage, Diagnose, Therapie, v, CTG,
Pädiater_informiert, AN_Aufklärung);
}
daten.close();
query.close();
}
catch(Exception e)
{
System.out.println("Fehler in Abfrage: "+ e);
}
System.out.println("Station: " + Station);
System.out.println("Name: " + Name);
System.out.println("privat: " + P_);
System.out.println("et: " + ET);
exeSql(sql);
}
...
Code:
...
private void exeSql(String sql)
{
//dbg.debug(sql);
try
{
Statement statement = db.createStatement();
statement.execute(sql);
statement.close();
db.commit();
} catch (Exception e)
{
dbg.debug("Fehler in exeSql: " + e.toString());
//System.out.println("in exeSql: " + e.toString());
rollbackMeth();
}
}
...