meine Anwendung funktionierte gut, aber dann habe ich etwas geändert und es nicht Datensätze in der Datenbank einfügen. wann immer ich die Taste, um es Toast zeigt uns einreichen drücken „Record eingefügt nicht“ Hier ist der CodeAndroid MS Sql Abfrage
connect=connn.ConnHelper(username, password, db, ipaddress);
if (connect == null){
Toast.makeText(getBaseContext(),"Connection Unsuccessfull",Toast.LENGTH_LONG).show();
}
else {
//inserting records in database
//is se nechy nechy
try {
st = connect.createStatement();
String query = "insert into profiles(Name,City,Address,Speciality,Phone,CNIC,Picture,Status) values('" + name + "','" + city + "','" + add + "','"+spec+"','"+ph+"','"+cn+"','"+img+"','pending');";
preStatement = connect.prepareStatement(query);
int k=preStatement.executeUpdate();
if(k==1){
Toast.makeText(getBaseContext(),"Record Inserted Successfully",Toast.LENGTH_LONG).show();
Intent imageIntent = new Intent("com.androsoft.application.Profile");
imageIntent.putExtra("Id",Cnic.getText().toString());
startActivity(imageIntent);
}
else{
Toast.makeText(getBaseContext(),"Record Not Inserted",Toast.LENGTH_LONG).show();
}
} catch (SQLException e) {
Toast.makeText(getBaseContext(),"Record Not Inserted",Toast.LENGTH_LONG).show();
}
hier seine Null zurückkehrt k. Mydatabase Entities sind.
ist 'add' in android nicht ein reserviertes Schlüsselwort ist? – Arulkumar
denke ich„add“Adresse ist –
Stellen Sie sicher, dass die Transaktion – VVB