I can not insert values to my SQL server 2008 from my SQLite database.Here is my code which i tried with lots of examples,but it failed.
dd =MainActivity.this.openOrCreateDatabase("Sellapp", MODE_PRIVATE, null);
Cursor crs = dd.rawQuery("SELECT * FROM customer", null);
while(crs.moveToNext()){
String uname = crs.getString(crs.getColumnIndex("id"));
String ucode= crs.getString(crs.getColumnIndex("cust_name"));
Log.v("executess", uname);
PreparedStatement stmt = connect.prepareStatement("insert into item_device (im_code, im_desc) values (?, ?");
stmt.setString(1, uname);
stmt.setString(2, ucode);
stmt.executeUpdate();
Log.v("EExecutess", ucode);
in the variables uname, u code i have my database values. when I am trying to list values from these variables I can do it without any error. But when I am trying To insert whole table to SQL server I could't do it.I tried examples from other questions but no one fits my problem.please anybody help. Thanks in advance..
Aucun commentaire:
Enregistrer un commentaire