gpt4 book ai didi

ColdFusion 查询属性重复

转载 作者:行者123 更新时间:2023-12-01 11:41:21 26 4
gpt4 key购买 nike

我正在为一个类开发一个基本的 ColdFusion 应用程序,但无法控制 CFAdmin。我想知道是否有一种方法可以避免在我的每个查询中重复属性数据源、用户名和密码,因为它们总是相同的。

替换:

<cfquery name="name"
datasource="datasource"
username="username"
password="password">

作者:

<cfquery name="name">

谢谢!

最佳答案

如果您使用的是 ColdFusion 9.01 或更高版本,您可以 set these values within Application.cfc .总结:

Application.cfc lets you specify data source authentication details for the data source. The data source settings can now be a string or a struct. When string, it is considered to be the data source name and authentication information is taken from the data source defined in the ColdFusion Administrator.

You can specify the authentication information using a struct value for data source. The following are the key names:

  • name: data source name
  • username: Username for the data source
  • password: Password for the data source

Example:

<cfset this.datasource={name='cfartgallery'
, username="user"
, password="passwd"}>

or

<cfset this.datasource="cfartgallery">

关于ColdFusion 查询属性重复,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/20294649/

26 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com