Well, I didn't get a response from the list, but I did figure it out
*sorta*.  It was the CFQUERYPARAM's that were killing it.  I did a trace on
the SQL Server, and it looks like the params just weren't getting passed,
maybe this is a function of the transaction, I'm not sure.  But I took out
the cfqueryparam's and just did it without them, and things are working just
fine.

So.  I'm responding just in case 3 months from now someone has the same
problem and searches the archive.  No idea why this happened.

J

-----Original Message-----
From: Josh Remus' Mailing List Account [mailto:[EMAIL PROTECTED]]
Sent: Friday, August 16, 2002 10:09 AM
To: CF-Talk
Subject: Strange JDBC/ODBC error on Insert statements...


I have a transaction here that was working fine, but is now returning
"[Macromedia][SQLServer JDBC Driver][SQLServer]Could not find prepared
statement with handle -1. " when executed.  I have also started and started
all MX services, hoping that it might fix it, it does not.  Again, the
strange this is that this was working just fine, and is now failing on any
insert (or at least, any insert with transactions and a set nocount off/on
statement).  Using CFMX on 2kserver/IIS and MSSQL7 on another machine (2k
server).  Here is one of the offending statements, the only difference
between this and the others that fail is Contact versus Account.  Removing
the address insert from the top also does nothing.

Hopefully someone has a clue!  Thanks!

-----------------------------------

 <cftransaction action="begin">

 <cfquery name="InsertAddress" datasource="CRMdb" debug="Yes">
 set nocount on

 insert into address(street1, street2, city, state, postal, country, attn)
 values(<cfqueryparam value="#form.street1#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.street2#" cfsqltype="cf_Sql_varchar">,
  <cfqueryparam value="#form.city#" cfsqltype="cf_sql_char">,
  <cfqueryparam value="#form.state#" cfsqltype="cf_Sql_varchar">,
  <cfqueryparam value="#form.postal#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.country#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.attn#" cfsqltype="cf_Sql_varchar">)

 select @@identity as currentaddressid

 set nocount off
 </cfquery>
 <cfquery name="InsertAccount" datasource="CRMdb" debug="Yes">
 set nocount on

 insert into accounts(accounttypeid, companyname, esacctid, espurchid,
mainphone, altphone, fax,
  emailtype, webaddress, createuserid, industryid, employees,
productinterestids, addressid)
 values(<cfqueryparam value="#form.accounttypeid#"
cfsqltype="cf_Sql_integer">,
  <cfqueryparam value="#form.companyname#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.esacctid#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.espurchid#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.mainphone#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.altphone#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.fax#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.emailtype#" cfsqltype="cf_sql_char">,
  <cfqueryparam value="#form.webaddress#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#client.userid#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.industryid#" cfsqltype="cf_sql_integer">,
  <cfqueryparam value="#form.employees#" cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#form.productinterestids#"
cfsqltype="cf_sql_varchar">,
  <cfqueryparam value="#insertaddress.currentaddressid#"
cfsqltype="cf_sql_integer">)

 select @@identity as currentaccountid

 set nocount off
 </cfquery>
  <cftransaction action="commit">
  </cftransaction>


---------------------------
Other Error Info:
      Error Executing Database Query.
      [Macromedia][SQLServer JDBC Driver][SQLServer]Could not find prepared
statement with handle -1.

      The Error Occurred in
C:\Inetpub\wwwroot\production_tree\Accounts\accounts_add.cfm: line 157
      Called from C:\Inetpub\wwwroot\production_tree\Accounts\accounts.cfm:
line 45
      Called from
C:\Inetpub\wwwroot\production_tree\Accounts\accounts_add.cfm: line 157
      Called from C:\Inetpub\wwwroot\production_tree\Accounts\accounts.cfm:
line 45

155 :
156 :   set nocount off
157 :   </cfquery>
158 :   <cfquery name="InsertAccount" datasource="CRMdb" debug="Yes">
159 :   set nocount on





______________________________________________________________________
Your ad could be here. Monies from ads go to support these lists and provide more 
resources for the community. http://www.fusionauthority.com/ads.cfm
FAQ: http://www.thenetprofits.co.uk/coldfusion/faq
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists

Reply via email to