Get a row,Column with a space in the column name ?

This works fine

LB.AddRow(row.Column("Groupe").StringValue)

while this does not:

LB.AddRow(row.Column("'Groupe'").StringValue)

In face, the Column name is Part Number and I coded it:

LB.AddRow(row.Column("'Part Number'").StringValue)

Because of the space between Part and Number.

I was able to create the TABLE as is.

Ideas ?

I changed my code a bit to use a sql string and its contents is:

SELECT * FROM Records WHERE ‘Groupe’=‘The Beatles’

No returned Row (the RowSet is empty), no error nor exception nor….

and this?

SELECT Groupe FROM Records WHERE Groupe='The Beatles'
Select [Part Number] AS PNR FROM ... WHERE [Part Number] = 'xy'

sqlite.org/lang_keywords

I assume you’re working with SQLite. The standard way to do this in a SQL query is to use double quotes around identifiers that might be misinterpreted (contains a space or other illegal character, using same name as a keyword, etc.). Of course, in Xojo, that means having to double-up the double quotes, like so:

db.SelectSQL("Select ""Part Number"" from Records..."

I don’t know if the same works for DatabaseRow.Column, I haven’t tried it:

row.Column("""Part Number""").StringValue

As Markus’ link shows, SQLite also supports square brackets [] or backticks ` to enclose identifiers. If those work through Xojo it would make it a little easier (not having to double-up the double quotes).

Or just do not create tables that have columns with spaces in the column names :slight_smile:

Brackets do not works. I will go my usual way as suggested by Norman (no space, no special char, only A-Z a-z characters.

And I will have to add a TABEL with one Record with the correct Column names :frowning:

Thank you all.

In case it was not notices earlier, this creates a TABLE:

"CREATE TABLE IF NOT EXISTS List(Groupe TEXT, 'Country' TEXT, 'Style' TEXT, 'Year Start' TEXT, 'Year End' TEXT, etc.

And the TABLE is correctly created.

BTW: the above TABLE is filled with INSERT without any problem.

The only trouble appears when reading, else I stopped to use spaces, parenthesesis, etc. as I usually do (since my Apple //c days).