请帮助,错误是“返回的sqlite:错误代码= 1,msg =靠近“端口”:语法错误,请帮助“:
此代码强制停止我的应用程序,请帮助纠正错误。
public static String DATABASENAME = "ftpdb";
public static String FTPTABLE = "fAccounts";
public static String colId = "id";
public static String colNmae = "name";
public static String colUserName = "username";
public static String colPassword = "password";
public static String colPort = "port";
public static String colHost = "host";
private ArrayList<FTPModel> ftpList = new ArrayList<FTPModel>();
Context c;
public DatabaseHelper(Context context) {
super(context, DATABASENAME, null, 33);
c = context;
}
@Override
public void onCreate(SQLiteDatabase db) {
db.execSQL("CREATE TABLE if not exists ftpAccounts(id INTEGER PRIMARY KEY AUTOINCREMENT,"
+ "name" + " TEXT ," + "username" + " TEXT," + "password" + " TEXT)" + "port" + " TEXT)" + "host" + " TEXT)");
}
@Override
public void onUpgrade(SQLiteDatabase db, int oldVersion, int newVersion) {
db.execSQL("DROP TABLE IF EXISTS" + FTPTABLE );
onCreate(db);
}
public void addProduct(FTPModel fm) {
SQLiteDatabase db = this.getWritableDatabase();
ContentValues contentValues = new ContentValues();
contentValues.put("name", fm.name);
contentValues.put("username", fm.username);
contentValues.put("password", fm.password);
contentValues.put("port", fm.port);
contentValues.put("host", fm.host);
db.insert("ftpAccounts", null, contentValues);
db.close();
}
public void removeProduct(String name, String username, String password, String port, String host) {
try {
String[] args = { name };
getWritableDatabase().delete("ftpAccounts", "name=?", args);
} catch (Exception e) {
}
}
public ArrayList<FTPModel> getAccounts() {
ftpList.clear();
SQLiteDatabase db = this.getWritableDatabase();
Cursor cursor = db.rawQuery("select * from ftpAccounts", null);
if (cursor.getCount() != 0) {
if (cursor.moveToFirst()) {
do {
FTPModel item = new FTPModel();
item.name = cursor.getString(cursor
.getColumnIndex("name"));
item.username = cursor.getString(cursor
.getColumnIndex("username"));
item.password= cursor.getString(cursor
.getColumnIndex("password"));
item.port= cursor.getString(cursor
.getColumnIndex("port"));
item.host= cursor.getString(cursor
.getColumnIndex("host"));
ftpList.add(item);
} while (cursor.moveToNext());
}
}
cursor.close();
db.close();
return ftpList;
}
}
请帮助更正代码,非常感谢