[ic] SQL insert with a form

Stefan Hornburg Racke interchange-users@interchange.redhat.com
Tue Nov 20 14:23:00 2001


Ed LaFrance <edl@newmediaems.com> writes:

> At 09:40 AM 11/20/2001 -0800, you wrote:
> > My database actually does an autoincrement on the Primary Key field, which
> > works
> 
> >fine when I use the
> >[query sql="INSERT INTO Tkt SET customerName='[value customerName]',
> >HelpDeskNum='[value HelpDeskNum]',serviceDate='[value serviceDate]',
> >LocationWork='[value LocationWork]', AfterHours='[value AfterHours]'"]
> >command.
> 
> Yep, but with form-based update, IC has to see valid data for the key value
> *in the form* or it will fail right off.

No, thats wrong in these 4.8.x days. You have to specify:

Database Tkt AUTO_SEQUENCE 1

> 
> 
> 
> >I have tried adding the primary key in the "mv_data_fields":
> >
> ><INPUT TYPE=HIDDEN NAME="mv_data_fields"
> >VALUE="tktnum,customerName,HelpDeskNum,serviceDate,LocationWork,AfterHours,
> >servicePerformed,host,domain">
> >
> >and having an input field with the tktnum, but I still get the error.
> >
> >Ticket Number: <INPUT NAME="tktnum" SIZE=30 >
> >
> > What I really want to do is escape out the sinqle quotes out of my test
> > before it
> 
> > gets written to the database, as the single quotes cause an SQL error. Any
> > ideas??

insert into foo (a,b,c) values ('d','e','f') will work with single
quotes.

Ciao
        Racke

-- 
Die Erde bleibt keine Scheibe. --- The earth remains no disk.

For projects and other business stuff please refer to COBOLT NetServices
(URL: http://www.cobolt.net; Email: info@cobolt.net; Phone: 0041-1-3884400)