Good afternoon
I am inserting data that I get from a webservices to my sqlite database only when I run my app it says that a column does not exist in a table
I have already changed the name of the database, version but follows the error
Error
E / SQLiteLog: (1) table clienton has no column named ClientKey
I leave code
public void insertcliente(int Empresa,
int Cliente,
String ClienteClave)
{
Object[] Data = {Empresa,Cliente,ClienteClave};
executeSQL("INSERT INTO " + DBhelper.TABLE_NAME + "(" + DBhelper.COLUMN_NAME_Empresa + "," + DBhelper.COLUMN_NAME_Cliente + "," + DBhelper.COLUMN_NAME_ClienteDescripcion + ") VALUES(?,?,?)", Data );
}
public static class DBhelper extends SQLiteOpenHelper {
private static final String TAG = "DBManager";
private static final String DATABASE_NAME = "hugo.db";
private static final int DATABASE_VERSION = 1;
public static final String TABLE_NAME = "clienteon";
public static final String COLUMN_NAME_Empresa = "Empresa";
public static final String COLUMN_NAME_Cliente = "Cliente";
//public static final String COLUMN_NAME_ClienteClave = "ClienteClave";
public static final String COLUMN_NAME_ClienteDescripcion = "ClienteDescripcion";
public static final String COLUMN_NAME_Moneda = "Moneda";
public static final String COLUMN_NAME_Proveedor = "Proveedor";
public static final String COLUMN_NAME_ProveedorDescripcion = "ProveedorDescripcion";
public static final String COLUMN_NAME_Saldo = "Saldo";
public static final String COLUMN_NAME_SaldoVencido = "SaldoVencido";
public static final String COLUMN_NAME_DatosGenerales = "DatosGenerales";
public static final String COLUMN_NAME_PRUEBA = "PRUEBA";
@Override
public void onCreate(SQLiteDatabase db) {
Log.w("[CHECK]", "DBHelper.onCreate....");
db.execSQL("CREATE TABLE " + DBhelper.TABLE_NAME + "("
+ DBhelper.COLUMN_NAME_Empresa + " TEXT ,"
+ DBhelper.COLUMN_NAME_Cliente + " TEXT "
+ DBhelper.COLUMN_NAME_ClienteDescripcion + "TEXT "
+ ");");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
Log.w(TAG, "Actualizacion de BDD de la version " + oldVersion + " a la "
+ newVersion + ", de la que se destruira la informacion anterior");
db.execSQL("DROP TABLE IF EXISTS " + DBhelper.TABLE_NAME);
onCreate(db);
}
DBhelper(Context context){
super(context, DATABASE_NAME, null, DATABASE_VERSION);
}
}
}
public STR_Resultado Clientes(int _Documento)
{
// Create request
SoapObject request = new SoapObject(ONControlWSNameSpace, "CXCPSaldoDocumento");
request.addProperty("Empresa",ONControlEmpresa);
request.addProperty("Token",ONControlToken);
request.addProperty("Documento",_Documento);
request.addProperty("Cliente", "0");
request.addProperty("Proveedor", "0");
request.addProperty("Moneda", "0");
request.addProperty("Zona", ONControlZonaCliente);
request.addProperty("Filtro", "E");
request.addProperty("FiltroAdicional", " ");
// Property which holds input parameters
SoapSerializationEnvelope envelope = new SoapSerializationEnvelope(SoapEnvelope.VER11);
envelope.dotNet = true;
envelope.implicitTypes = false;
// Set output SOAP object
envelope.setOutputSoapObject(request);
// Create HTTP call object
HttpTransportSE androidHttpTransport = new HttpTransportSE(ONControlWSURL, 7000);
STR_Resultado O_Resultado = new STR_Resultado();
O_Resultado.ClienteArray = new ArrayList();
//ArrayAdapter<String> arrayadapter;
try {
androidHttpTransport.debug = true;
// Invoke web service
androidHttpTransport.call(ONControlWSNameSpace+"CXCPSaldoDocumento", envelope);
SoapObject response = (SoapObject) envelope.getResponse();
O_Resultado.ErrorId= Integer.parseInt(response.getProperty(0).toString());
O_Resultado.UltimoId= Integer.parseInt(response.getProperty(1).toString());
O_Resultado.Mensaje= String.valueOf(response.getProperty(2));
SoapObject SO_CXCPClienteProveedor = (SoapObject)((SoapObject)((SoapObject)((SoapObject) envelope.getResponse()).getProperty(3)).getProperty(1)).getProperty(0);
for (int i = 0; i < SO_CXCPClienteProveedor.getPropertyCount(); i++) {
Clientes.oBD.insertcliente(ONC_SYS.NullToZeroInteger(webService.WSGetPropertyNull("Empresa", (SoapObject) SO_CXCPClienteProveedor.getProperty(i))),
ONC_SYS.NullToZeroInteger(webService.WSGetPropertyNull("Cliente", (SoapObject) SO_CXCPClienteProveedor.getProperty(i))),
webService.WSGetPropertyNull("ClienteClave", (SoapObject) SO_CXCPClienteProveedor.getProperty(i)));
}
} catch (Exception e) {
e.printStackTrace();
}
return O_Resultado;
}