Diese Seite mit anderen teilen ...

Informationen zum Thema:
WinDev Forum
Beiträge im Thema:
Erster Beitrag:
vor 2 Jahren, 10 Monaten
Letzter Beitrag:
vor 2 Jahren, 10 Monaten
Beteiligte Autoren:
Joel, Piet van Zanten, Fabrice Harari

[WB19] - Help with SQL Statement - unexpected word ","

Startbeitrag von Joel am 18.08.2015 10:03

Hi - Can't figure this out -

sSQL is string = [
gpsdContact.GUIDHFContact = gpoDB:m_sdContactList_ActiveOrEnrolled.GUIDHFContact
gpsdContact.sLastName, gpsdContact.sFirstName

IF NOT HExecuteSQLQuery(gpoDB:m_sdReportSource,sSQL) THEN
gpoError:CaptureError(HErrorInfo()) // Error while declaring the file, display the error

I keep getting the error - Unexpected Word ","

gpoDB:m_sdContactList_ActiveOrEnrolled is a Data Source initialized earlier.


Hi Joel

1. if you use the query editor, you won't have this kind of problems, as the syntax will ALWAYS be correct

2. I'm guessing that your problem comes from the parameter gpoDB:m_sdContactList_ActiveOrEnrolled.GUIDHFContact.
- It probably needs to be between quotes
- and it should be replaced by the value before doing the hexecutesqlquery. hexecutesqlquery just uses the string AS IS (and I'm pretty sure that it doen't know "gpoDB:m_sdContactList_ActiveOrEnrolled.GUIDHFContact"

So my advise: use the query editor, declare a parameter in it for your condition, and set the parameter before doing a simple hexecuteQuery

Best regards

von Fabrice Harari - am 18.08.2015 10:40
Hi Fabrice and thank you. Can't use the Query Editor because there is no analysis in the Project. Analysis is in only 1 project module - the Login Module. Physical Data Files are made each time that Project is opened if they don't yet exist. All other projects use HDeclareExternal to connect to the datafiles. This is a little embarrassing, but at the moment, I can't remember why I did that. It was to solve some problem, but I can't remember why I didn't just share the Analysis in each project. I broke the one massive Project into about 15+ smaller one - makes changes and updates much easier. Anyway, I've had to learn SQL to create Data Sources as a result.

I was kinda thinking that the SQL couldn't understand the "gpoDB: m_sdContactList_ActiveOrEnrolled.GUIDHFContact" parameter, but was hoping that wasn't it. Ugh!

von Joel - am 18.08.2015 12:14
Hi Joel,

With text sql queries you need to use stringbuild to insert parameters into the query:

gpsdContact.GUIDHFContact = '%1'
gpsdContact.sLastName, gpsdContact.sFirstName

IF NOT HExecuteSQLQuery(gpoDB:m_sdReportSource,StringBuild(sSQL,gpoDB:m_sdContactList_ActiveOrEnrolled.GUIDHFContact)) THEN


von Piet van Zanten - am 18.08.2015 15:19
Zur Information:
MySnip.de hat keinen Einfluss auf die Inhalte der Beiträge. Bitte kontaktieren Sie den Administrator des Forums bei Problemen oder Löschforderungen über die Kontaktseite.
Falls die Kontaktaufnahme mit dem Administrator des Forums fehlschlägt, kontaktieren Sie uns bitte über die in unserem Impressum angegebenen Daten.