I have written a testing file with the following code.
I got an error which follows the code:


<body>
<CFOUTPUT>
<cfparam name="form.testing" default="Joe's">


<form action="DeleteThis.cfm" method="post">
        <input type="Text" size="7" name="testing"
value="#form.testing#">
        <input type="submit">
</form>

<cfset FLD = replace(#FORM.TESTING#, "'", "''")>
<cfquery name="TheTest" datasource="#eq_dsn#">
        insert into testing(id,loc_city)
        values ('8888','#FLD#')
</cfquery>


</cfoutput>
</body>

Error Message:
**************

ODBC Error Code = 23000 (Integrity constraint
violation)


[Microsoft][ODBC SQL Server Driver][SQL Server]Cannot
insert explicit value for identity column in table
'drpResults' when IDENTITY_INSERT is set to OFF.


SQL = "insert into drpResults(id,loc_city) values
('8888','Joe''''s')"

Can someone tell me how to turn on the IDENTITY_INSERT
property of SQL Server?

Appreciate
A.B.

--- Heather Haindel <[EMAIL PROTECTED]> wrote:
> <cfset fld = replace(fld, "'", "''")> would do that.
> "fld" is your string.
> 
> --- aslam bajaria <[EMAIL PROTECTED]> wrote:
> > Can someone tell me how to parse a string. Like if
> > the
> > user inputs JOE'S COMPANY in the text box, how do
> I
> > search for the apostrophe and then use the
> following
> > code to insert in the database. 
> > 
> > Appreciate.
> > A.B.
> > 
> > --- Larry Meadors <[EMAIL PROTECTED]> wrote:
> > > I use <cfset fld = replace(fld, "'", "''")> to
> > > replace a single quote with two quotes, then
> > insert
> > > that value into the database. 
> > > 
> > > This works for both SQLServer and Oracle.
> > > 
> > > Larry
> 
> __________________________________________________
> Do You Yahoo!?
> Talk to your friends online and get email alerts
> with Yahoo! Messenger.
> http://im.yahoo.com/
>
------------------------------------------------------------------------------
> Archives: http://www.eGroups.com/list/cf-talk
> To Unsubscribe visit
>
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk
> or send a message to
> [EMAIL PROTECTED] with 'unsubscribe'
> in the body.

__________________________________________________
Do You Yahoo!?
Talk to your friends online and get email alerts with Yahoo! Messenger.
http://im.yahoo.com/
------------------------------------------------------------------------------
Archives: http://www.eGroups.com/list/cf-talk
To Unsubscribe visit 
http://www.houseoffusion.com/index.cfm?sidebar=lists&body=lists/cf_talk or send a 
message to [EMAIL PROTECTED] with 'unsubscribe' in the body.

Reply via email to