Book a Demo

Author Topic: GetByName  (Read 3978 times)

Beren

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
GetByName
« on: April 09, 2007, 12:14:48 am »
Hello,
I'm working with the Automation Interface and I get the following error:

DAO.QueryDef [3075]
Syntax error (missing operator) in query expression 'Name='<RNFO-007>Obligatoriedad de campos: 'Datos Solicitante'' AND Object_ID in (13,14,117,118,17,7)'.


I'm getting this error when using the function GetByName() and the string used contains the character ' .
I whish to know is there is any way to escape this character to avoid this error or something like that.

The code I'm using is:

EA_Elem = (EA.Element)EA_Pkg.Elements.GetByName(EA_ElemName);

which work perfectly as long as the string EA_ElemName doesn't contains '

Thank you

Jose

thomaskilian

  • Guest
Re: GetByName
« Reply #1 on: April 10, 2007, 06:41:19 am »
Looks like a bug. You should report that to Sparx.

Beren

  • EA Novice
  • *
  • Posts: 3
  • Karma: +0/-0
  • I love YaBB 1G - SP1!
    • View Profile
Re: GetByName
« Reply #2 on: April 10, 2007, 07:39:24 am »
Ok, done
Thank you

«Midnight»

  • EA Guru
  • *****
  • Posts: 5651
  • Karma: +0/-0
  • That nice Mister Grey
    • View Profile
Re: GetByName
« Reply #3 on: April 10, 2007, 01:07:28 pm »
While you wait for a solution, it might be possible to perform the operation by first updating the element name to use a double apostrophe each time there is a single one.

What I mean is to replace each occurrence of an "'" with "''". This would produce the escaped string that an SQL query expects, which is probably why the current code throws an error.
No, you can't have it!