Reputation: 31
Error Code : 1 (SQLITE_ERROR) Caused By : SQL(query) error or missing database.
(duplicate column name: Floor (code 1)
while compiling:
CREATE TABLE LocalizationInfo(_item INTEGER PRIMARY KEY, idINT,Floor TEXT, Floor HeightTEXT, Adress TEXT ,LatitudeTEXT, LongitudeTEXT, Altitude TEXT,Pressure TEXT)
I tried to save my data i.e. Floor,Floor height, GPS data and Adress which was obtained from another activity to another which implements the SQLite data for saving,loading,editting and deletion. I am always receiving this error message when i try to add the data from the other activity to the database by clicking the list or post button which directs the user to the database.
Upvotes: 3
Views: 10460
Reputation: 7220
may u do not set the value for rows/columns of the table Ex:
private static final String NEWS_PUBLISHER = "news_publisher";
private static final String NEWS_CONTENT = "news_content";
private static final String NEWS_DATE = "news_date";
maybe u set one name for all this ...
Upvotes: 0
Reputation: 56948
Your issue is that
CREATE TABLE LocalizationInfo(
_item INTEGER PRIMARY KEY,
idINT,
Floor TEXT,
Floor HeightTEXT,
Adress TEXT ,
LatitudeTEXT,
LongitudeTEXT,
Altitude TEXT,
Pressure TEXT
)
Just correcting 1 would end up creating columns (which would likely result in ongoing issues) :-
Try changing to use :-
CREATE TABLE LocalizationInfo(
_item INTEGER PRIMARY KEY,
id INT,
Floor TEXT,
FloorHeight TEXT,
Adress TEXT ,
Latitude TEXT,
Longitude TEXT,
Altitude TEXT,
Pressure TEXT
)
You will need to either delete/clear the App's data or uninstall the App and then rerun the App, as the onCreate method won't run because the database exists.
Upvotes: 2
Reputation: 182
I think your problem caused by using whitespace for your colum name Floor Height. It would be good idea that you should use underscore instead of whitespace for column names. You can define your column names like floor, floor_height, gps_data and address.
Upvotes: 2
Reputation: 94
try not to put space between Floor Height, if you want you can do _ ie. Floor_Height TEXT
Upvotes: 2