query in Java

S

shoa

Hello

I have fields "Account Name" and "Address" in an Access table "person" then
I use a query to insert a record:

"Insert INTO person (Address, Account Name) Values ('USA', 'John').
However there is error when I inserted this record.

My question is:
Can I use insert query for a field name that has a blank char. Im my case,
there is a blank char between "Account" and "Name".

Thank you for any help
S.Hoa
 
S

Steve W. Jackson

"shoa" <[email protected]> said:
Hello

I have fields "Account Name" and "Address" in an Access table "person" then
I use a query to insert a record:

"Insert INTO person (Address, Account Name) Values ('USA', 'John').
However there is error when I inserted this record.

My question is:
Can I use insert query for a field name that has a blank char. Im my case,
there is a blank char between "Account" and "Name".

Thank you for any help
S.Hoa

It's better not to use names with spaces in them. Most *real* database
engines don't allow it. But you can do so by putting escaped double
quotes around the names. So the literal string in your example above,
after adding the closing quote you left off, would be:

"Insert INTO person (Address, \"Account Name\") Values ('USA', 'John')"

= Steve =
 
V

Virgil Green

shoa said:
Hello

I have fields "Account Name" and "Address" in an Access table
"person" then I use a query to insert a record:

"Insert INTO person (Address, Account Name) Values ('USA', 'John').
However there is error when I inserted this record.

My question is:
Can I use insert query for a field name that has a blank char. Im my
case, there is a blank char between "Account" and "Name".

Thank you for any help
S.Hoa

What happened when you tried it?

Consider putting the name in brackets like [Account Name] though I don't
know if that will do it.
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,780
Messages
2,569,608
Members
45,241
Latest member
Lisa1997

Latest Threads

Top