How to Execute 2 or more insert statements using CFQuery in coldfusion?

前端 未结 6 1406
予麋鹿
予麋鹿 2021-01-13 08:29

Is it possible to Execute 2 insert or Update Statements using cfquery?

If yes how?

if no, what is the best way to execute multiple queries in Co

6条回答
  •  情歌与酒
    2021-01-13 08:52

    Within the data source settings you can tell it whether to keep connections open or not with the Maintain Connections setting.

    Starting with, I believe, ColdFusion 8 datasources are set up to run only one query at a time due to concerns with SQL injection. To change this you would need to modify with the connection string.

    Your best bet is to turn on Maintain Connections and if needed use cftransaction:

    
    
    insert into table1 values()
    
    
    insert into table2 values()
    
    
    

    And always, always use cfqueryparam for values submitted by users.

提交回复
热议问题