Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
SQL insert problem
i my clients database is a field with name 'E-Mail', qm gives error in sql statement.

Copy      Help
sql="INSERT INTO Adressen (EMISNummer,E-Mail) VALUES (8765,'')"

i can't rename it, because another software is using this database.

whatt o do?
found the solution:

Copy      Help
sql="INSERT INTO Adressen (EMISNummer,`E-Mail`) VALUES (8765,'')"

what is the english name for ` ?
it is a 'grave accent';
Quote:On many computer keyboards, the grave accent occupies a key by itself, and is meant to be combined with vowels as a multi-key combination. However, programmers have used the key by itself for a number of tasks.

on a pc hit "ctl-`" then a vowel and it prints the À à types of letters.
A new blog on QM coding and automation.

The Macro Hook
do you know how to deal with with apostrophe in values ?
maybe a escape in the sql statement ?

Copy      Help
,sql="INSERT INTO Adressen (EMISNummer,FB1,FB2,Strasse,Land,PLZ,Ort,Bundesland,Telefon,Telefax,`E-Mail`,Internet,Adressgruppe,Sonstiges2,UnterAdressgruppe,Kundenstatus,Kontakt) VALUES (XXX)"
,values.format("%i,'%s','%s','%s','%s','%s','%s','%s'," zaehler FB1 FB2 Strasse Land PLZ Ort Bundesland)
,values.formata("'%s','%s','%s','%s','%s'," Telefon Telefax EMail Website Adressgruppe)
,values.formata("'%s','%s','%s','%s'" Sonstiges2 UnterAdressgruppe Kundenstatus Kontakt)

FB1 (company name) is Ain't Missbehavin'
i can't change the name.
yeah, that's where i would start.
A new blog on QM coding and automation.

The Macro Hook
Copy      Help
FB1.findreplace("'" "´")

works, but in my clients software you can use apostrophe in company and product names.
his program is writing it in plain text to the mdb.

all the tips i found so far speak about chr$(34) or replace ' with ''
but we are not in vb land here Confusedhock:
now i am completely confused

when in the first database where i gather my info the name
is Ain''t Missbehavin'' it will be inserted in the second db
as Ain't Missbehavin'

but when i use
FB1.findreplace("'" "''") on orginal name it will be inserted as
Ain"t Missbehavin"

help :?: :?: :?: :?:
that's because you're searching for the ' and replacing it with a "

i think it'll work with
str FB1.findreplace("''" "'")
A new blog on QM coding and automation.

The Macro Hook
that was just a test, Ain't Missbehavin' is the original name.

Forum Jump:

Users browsing this thread: 1 Guest(s)