Hello, it's again me
I want to make an index (primary key) in a SQL table and want to use the AUTO_INCREMENT parametre
To Add a data, I try this code:
I receive a message "Table has 3 column but only 2 values were supplied"
So I change my program to :
To Add a data, I try this code:
But now, when I check the table (SQLViewer), the column 'index' is empty.
Where is my mistake ?
A+
I want to make an index (primary key) in a SQL table and want to use the AUTO_INCREMENT parametre
B4X:
'Table creation
query="CREATE TABLE IF NOT EXISTS [table] ([Index] INTEGER AUTO_INCREMENT PRIMARY KEY, [Data1] TEXT, [Data2] TEXT)"
SQL1.ExecNonQuery(query)
To Add a data, I try this code:
B4X:
' Add data
query="INSERT INTO table VALUES ('text1', 'text2')"
SQL1.ExecNonQuery(query)
I receive a message "Table has 3 column but only 2 values were supplied"
So I change my program to :
To Add a data, I try this code:
B4X:
' Add data
query="INSERT INTO table VALUES ('','text1', 'text2')"
SQL1.ExecNonQuery(query)
But now, when I check the table (SQLViewer), the column 'index' is empty.
Where is my mistake ?
A+