-1
這是我的代碼來創建數據庫,但它不起作用,我不知道爲什麼。關於創建數據庫的sqlite日誌
public class DBAdapter {
private static final String DATABASE_NAME = "Enquete15";
private static final int DATABASE_VERSION = 3;
private static final String MENAGE = "table_MENAGE";
private static final String _id = "Numero_du_Questionnaire";
private static final String col_Code_district = "Code_district";
private static final String col_Region= "region";
private static final String col_Provence_prefecture = "provence_prefecture";
private static final String col_Commune_Arrondissement = "Commune_Arrondissement ";
private static final String col_N_district = "Numero_district ";
private static final String col_N_M_district = "N_ménage_district ";
private static final String col_N_menage_logement = "N_menage_logement ";
private static final String col_Adresse_menage = "Adresse_menage";
private static final String col_Nom_Enqueteur = "Nom_enqueteur";
private static final String col_code_enquêteur = "code_enqueteur ";
private static final String col_Date_realisation_enquête = "Date_réalisation_enquête ";
private static final String col_Nom_controleur = "Nom_contrôleur ";
private static final String col_code_controleur = "code_contrôleur ";
private static final String col_Date_controle = "Date_contrôle ";
private static final String col_echantillon_principal = "echantillon_principal";
private static final String col_Statut_enquêté = "Statut_enquêté ";
private static final String col_Observations = "Observations ";
private static final String col_Type_habitat = "Type_habitat";
private static final String col_Statut_occupation = "Statut_occupation ";
private static final String col_Nombre_ménages_habitant_logement = "Nombre_ménages_habitant_logement ";
private static final String col_Nombre_pièces_occupes_ménage = "Nombre_pièces_occupés_ménage ";
private static final String col_Mode_principal_approvisionnement_eau_potable = "Mode_principal_approvisionnement_eau_potable ";
private static final String col_Mode_principal_éclairage = "Mode_principal_éclairage ";
private static final String col_Mode_principal_assainissement = "Mode_principal_assainissement ";
private static final String col_Disposition_local_cuisine = "Disposition_local_cuisine ";
private static final String col_Disposition_local_WC = "Disposition_local_WC ";
private static final String col_Disposition_salle_eau = "Disposition_salle_eau(douche_baignoire) ";
private static final String DATABASE_CREATE = "CREATE TABLE " + MENAGE + "(" + _id +" INTEGER PRIMARY KEY AUTOINCREMENT,"
+ col_Region +" TEXT,"+ col_Provence_prefecture +" TEXT,"
+ col_Commune_Arrondissement +" TEXT,"+ col_N_district +" INT,"
+ col_N_M_district +" INT,"+ col_N_menage_logement +" INT,"+ col_Adresse_menage + " INT,"
+ col_Nom_Enqueteur +" INT,"+ col_code_enquêteur +" INT,"+ col_Date_realisation_enquête +" INT,"+ col_Nom_controleur +" INT,"+ col_code_controleur +" INT,"+ col_Date_controle +" INT,"+ col_echantillon_principal +" INT,"+ col_Statut_enquêté +" INT,"+ col_Observations +" INT,"+ col_Type_habitat +" INT,"+ col_Statut_occupation +" INT,"+ col_Nombre_ménages_habitant_logement +" INT,"
+ col_Nombre_pièces_occupes_ménage +" INT,"+ col_Mode_principal_approvisionnement_eau_potable +" INT,"
+ col_Mode_principal_éclairage +" INT,"+ col_Mode_principal_assainissement +" INT,"
+ col_Disposition_local_cuisine +" INT,"+ col_Disposition_local_WC +" INT,"
+ col_Disposition_salle_eau + " INT,"+ col_Disposition_local_WC +" INT" + ")";
的logcat中顯示了語法錯誤附近「(」
發佈你的logcat如果有錯誤,你的數據庫合同(表名和列),並解釋什麼「沒有工作」。我們不能試圖猜測問題的所有可能性。我現在的猜測是:1.它試圖創建一個現有的表,或者2.錯誤地使用'_id'。 –
感謝您的迴應,logcat指出一個sqlite日誌(1)附近「(」:語法錯誤。我嘗試了很多次,但它沒有工作。再次感謝 –
這將是偉大的,如果有人有一個想法如何解決問題,我已經通過嘗試很多可能性尋找解決方案,但它不工作! –