Avatar billede thomashove Nybegynder
30. maj 2003 - 14:01 Der er 7 kommentarer og
2 løsninger

Insert Into

Kan det passe at Access ikke kan håndtere flg.

Insert into Users (Users.Name) values ('navnet')

problemet er at Access hele tiden melder tilbage at Users.name er et invalid field name.

det virker selvfølgelig hvis jeg fjerner "Users." men problemt er at jeg tilgår databasen via et Dataset i Borland Builder C++ og jeg dermed ikke selv laver SQL'en
Avatar billede terry Ekspert
30. maj 2003 - 17:43 #1
Insert into Users ([Name]) values ('navnet')
Avatar billede terry Ekspert
30. maj 2003 - 17:46 #2
NOTE: Name may be a reserved word so putting it in [] gets around this.

Users.Name is this because Borland isnt standard SQL! I cant recal seeing an INSERT where it is necessary to give the table name in the fields list!
Avatar billede thomashove Nybegynder
31. maj 2003 - 11:46 #3
I don't know whether or not Borland uses standard SQL but the fact is that it uses the table names in the fields list...

The application used to run on a paradox database whitout problems but converting it to Access has been rather problematic...

I have found the workaround to create the SQL myself using Quieries instead of Datasets - but it is rather boring to rewrite the program everytime an Insert is needed.

I thought that maybe a newer Access driver for ODBC could solve the problem but so far no luck...
Avatar billede terry Ekspert
31. maj 2003 - 15:35 #4
Thomas>I'm using Access XP (the newest version) and I cant use the table in the fields list, so I very mucg dount its going to help :o(
Avatar billede terry Ekspert
31. maj 2003 - 15:37 #5
I dont know anything about Borland but even in Access VBA (code) I build my SQL statements dynamically. It does take longer to make but once made its muh more flexibly.
Avatar billede terry Ekspert
03. juni 2003 - 20:11 #6
Thomas>Hows it going here?
Avatar billede thomashove Nybegynder
03. juni 2003 - 21:50 #7
My conclusion is that Access dosn't understand SQL strings with the table name in the fields list when making an INSERT.

So I have rewritten the program code so I make the SQL myself...

rather annoying :(

you get 10p for the effort....
Avatar billede thomashove Nybegynder
03. juni 2003 - 21:50 #8
closing
Avatar billede terry Ekspert
04. juni 2003 - 19:42 #9
Thanks Thomas.
"My conclusion is that Access dosn't understand SQL strings with the table name in the fields list when making an INSERT."

Thats what I have been saying all along :o) Nothing wrong with Access here, I just think it VERY unnormal that it is necessary in any SQL
Avatar billede Ny bruger Nybegynder

Din løsning...

Tilladte BB-code-tags: [b]fed[/b] [i]kursiv[/i] [u]understreget[/u] Web- og emailadresser omdannes automatisk til links. Der sættes "nofollow" på alle links.

Loading billede Opret Preview
Kategori
Dyk ned i databasernes verden på et af vores praksisnære Access-kurser

Log ind eller opret profil

Hov!

For at kunne deltage på Computerworld Eksperten skal du være logget ind.

Det er heldigvis nemt at oprette en bruger: Det tager to minutter og du kan vælge at bruge enten e-mail, Facebook eller Google som login.

Du kan også logge ind via nedenstående tjenester