Forums

This topic is locked

Dreamweaver MX SQL parameter handling

Posted 01 Jan 2003 23:36:48
1
has voted
01 Jan 2003 23:36:48 Andrew Korvin posted:
I am struggling with a problem in Dreamweaver MX.

I have a database application dealing with event types that I'm trying to write a front end for. I have created a SQL query that selects events based on start date AND multiple event types ( ie MTG for "Meeting", CON for "Conference" etc. )

I am trying to query a SQL Anwywhere database and I have built a query in Infomaker ( Client Server report writer ) that accepts a date and a STRING ARRAY as arguments.

For example:

SELECT ev200_event_master.ev200_evt_id,
ev200_event_master.ev200_evt_desc,
ev200_event_master.ev200_mi_date,
ev200_event_master.ev200_mo_date,
ev200_event_master.ev200_evt_type
FROM ev200_event_master
WHERE ( ev200_event_master.ev200_evt_type in ( :Event_type ) ) AND
( ev200_event_master.ev200_mi_date >= :Start_date )

ORDER BY ev200_event_master.ev200_mi_date ASC

Pretty simple ? You don't have to know much SQL to see how easy this is. It works fine. It accepts a simple string array like MTG,CON and returns both types. The problem is that in Dreamweaver, no matter how I construct the query - I can only retrieve ONE event type with the following syntax ( essentially the same )

SELECT EV200_EVT_ID, EV200_EVT_DESC, EV200_MI_DATE, EV200_MO_DATE, EV200_EVT_TYPE
FROM gpcb.EV200_EVENT_MASTER
WHERE EV200_MI_DATE >= ? AND EV200_EVT_TYPE IN (?)
ORDER BY EV200_MI_DATE ASC

I am testing the query directly with the advanced query builder in Dreamweaver MX and it works for ONE type ( ie 'MTG) but if I try to pass the string array THE WAY I KNOW THE DATABASE WANTS IT - it doesn't work.

Why?

I can't see why this is so difficult. It's just supposed to pass text to the database engine...

Somebody must have an answer for this?

Replies

Replied 03 Jan 2003 15:09:54
03 Jan 2003 15:09:54 carolus Holman replied:
I have experienced what you are going through. Make sure you get the quotes correct when passing the SQL string into the SQL application. Dreamweaver or the server truncates the string after the first set of quotes, ie:

IN ('ParamOne','ParamTwo','ParamThree') I rewrote the string: IN("'ParamOne','ParamTwo','ParamThree'" or something like that, I do remember it something to do with QUOTES.

Carolus Holman
Replied 03 Jan 2003 19:19:53
03 Jan 2003 19:19:53 Andrew Korvin replied:
Thanks... I'll try it. I figured it had something to do with parsing quotes. The odd thing is that I don't have to supply any quotes when I use the report writer directly - just a comma between the array elements. The query was written in infomaker and the syntax seems different from Access. But I'll try your suggestion - it has to be something like that.

Reply to this topic