Home | Contact Us | FAQ | Search & Site Map | Link to Us
Sign In | Join | Other 45 Sites in Network
HomeAnnouncementsWhite Papers
Discussion GroupsFirst AidDatabasesJavaBeansGUIJava 3DVirtual MachineCORBASecurityToolsGeneral
Java DirectoryOpen Source ProjectsSample Book ChaptersUser GroupsWeb Resources
Related Topics
Databases.NETMore Topics ...

Java Forum / General / June 2005

Tip: Looking for answers? Try searching our database.

query in Java

Thread view: 
shoa - 28 Jun 2005 04:53 GMT
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
Steve W. Jackson - 28 Jun 2005 19:56 GMT
> Hello
>
[quoted text clipped - 10 lines]
> 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 =
Signature

Steve W. Jackson
Montgomery, Alabama

Virgil Green - 29 Jun 2005 18:55 GMT
> Hello
>
[quoted text clipped - 10 lines]
> 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.

Signature

Virgil



Free Magazines

Get these publications absolutely FREE for up to 12 months. There are no hidden fees and no obligation. Simply choose a title, complete the application form and submit it. Read more ...

Oracle MagazineNetwork ComputingComputer WorldBio-IT WorldeWeekInformation WeekInfosecurity
 
Sign In
Join
My Latest Posts
My Monitored Threads
My Blog
My Photo Gallery
My Profile
My Homepage

Start New Thread
Enable EMail Alerts
Rate this Thread



©2008 Advenet LLC   Privacy Policy - Terms of Use
This website includes both content owned or controlled by Advenet as well as content owned or controlled by third parties.