标签: coldfusion-9

在ColdFusion 9中为MSSQL设置数据源

我正在尝试为我的托管公司托管的数据库设置数据源.我正在使用ColdFusion Administrator 9创建数据源.我打电话给我的托管公司并收到了所有必要的信息以便开展工作.在输入必要的信息后,我得到一个连接失败,这意味着它已超时.我注意到当管理员页面出现创建数据源时,默认端口号是1433.这是常见的吗?我觉得我输入的所有必要信息都是正确的(用户名,密码,数据库名称,服务器等;).有人可以提供任何建议吗?

以下是错误:数据源的连接验证失败:cfhalloween java.sql.SQLNonTransientConnectionException:[Macromedia] [SQLServer JDBC Driver]建立套接字时出错.未知主机:s根本原因是:java.sql.SQLNonTransientConnectionException:[Macromedia] [SQLServer JDBC Driver]建立套接字时出错.未知主持人:s

sql-server coldfusion-9

0
推荐指数
1
解决办法
1563
查看次数

使用<cfinclude>和this.mapping

在我的应用程序中,我有一个页眉和页脚包含.在我的Application.cfc中,我设置了一个命名我的应用程序并设置映射的函数.

<cfcomponent output="no">
<cfset this.name = "thesitename">
<cfset this.datasource = "thesitedatasource">
<cfset this.rootDir = getDirectoryFromPath(getCurrentTemplatePath()) />
<cfset this.mappings = structNew()>
<cfset this.mappings["/planning"] =  "#this.rootDir#planning/" />
<cfset this.mappings["/images"] = "#this.rootDir#images/" />
<cfset this.mappings["/includes"] = "#this.rootDir#includes/" />
<cfset this.mappings["/js"] = "#this.rootDir#js/" />
<cfset this.mappings["/portfolio"] = "#this.rootDir#portfolio/" />
</cfcomponent>
Run Code Online (Sandbox Code Playgroud)

如果我有一个页面在这样的子目录:planning/index.cfm<cfinclude>无法找到时,我使用以下路径的图像文件夹什么:<li class="imagelink"><img src="/images/facebook.png"></li>

根目录中的页面没有问题.

如果我理解正确,问题与在调用include之前不会发生映射有关,或类似的事情......如何让我的include中的映射路径正常工作?

mapping coldfusion application.cfc coldfusion-9

0
推荐指数
1
解决办法
648
查看次数

如何强制MS Word下载到特定位置

我使用下面的代码将MS Word文件下载到默认下载文件夹.但我需要将文档下载到特定位置.我怎样才能做到这一点?

码:

<cfcontent type="application/msword">
<cfheader name="content-Disposition" value="attachment;filename=Simple_run.doc">
Run Code Online (Sandbox Code Playgroud)

coldfusion coldfusion-9

0
推荐指数
2
解决办法
260
查看次数

使用cfscript在查询对象addParam中转换日期的问题

我正在使用cfscript语法创建一个查询,我有两个日期查询参数.我第一次使用时创建了日期字符串

queryservice.addParam(
     name="last_update",
     value="createODBCDate(now())",
     cfsqltype="cf_sql_date");
Run Code Online (Sandbox Code Playgroud)

我认为这可以类似于:

<cfqueryparam value="#createODBCDate(now())#" cfsqltype="cf_sql_date">
Run Code Online (Sandbox Code Playgroud)

所以,当我运行查询时,我得到:

The cause of this output exception was that: coldfusion.runtime.Cast$DateStringConversionException: The value createODBCDate(now()) cannot be converted to a date.
Run Code Online (Sandbox Code Playgroud)

精细.所以我创建了一个变量,

var currentDate = createODBCDate(now());
Run Code Online (Sandbox Code Playgroud)

把它添加到

queryservice.addParam(
     name="last_update",
     value="createODBCDate(now())",
     cfsqltype="cf_sql_date");
Run Code Online (Sandbox Code Playgroud)

得到了

The cause of this output exception was that: coldfusion.runtime.Cast$DateStringConversionException: The value currentDate cannot be converted to a date.
Run Code Online (Sandbox Code Playgroud)

当我使用标准<cfquery ...语法创建查询时,它工作正常.

所以,我假设我做错了什么,但我不能为我的生活找出那是什么.

顺便说一句,这是我第一次尝试使用<cfscript>语法创建查询.

coldfusion coldfusion-9

0
推荐指数
1
解决办法
923
查看次数

CFSCRIPT中的缓慢事务性能

我最近注意到我们的产品有许多"短"邮政编码的错误邮政编码位置(纬度和长坐标) - 即"AB10"而不是"ABD 1PT"等.

邮政编码数据库/表格用于在谷歌地图上生成图钉,我现在已经知道,当我们将短邮政编码合并到带有完整邮政编码的表格时,有些(约2200)被错误地输入了经度和纬度绕错了路.

显然这是一个简单的修复,因此我决定编写一个小脚本来处理不正确的值(基本上交换它们).

这是我有的:

<cfscript>

  /** Fetch the wrong postcodes data **/
  db  = "postcodes";
  sql = "
    SELECT
      postcode, longitude, latitude
    FROM
      postcodes
    WHERE
      longitude > latitude
  ";
  q    = new Query(sql = trim(sql), datasource = db);
  data = q.execute().getResult();

  if (structKeyExists(form, "execute")) {
    if (isQuery(data) && data.recordCount > 0) {
      transaction action="begin" 
      { 
        try {
          qUpdate = new Query(
            datasource = db, 
            sql = "UPDATE postcodes SET longitude = :longitude, latitude = :latitude WHERE postcode …
Run Code Online (Sandbox Code Playgroud)

mysql coldfusion coldfusion-9

0
推荐指数
1
解决办法
353
查看次数

Coldfusion加密和解密

我在使用cf9加密和解密功能时遇到问题.具体来说,我使用的代码需要能够使用AES/ECB/PKCS5Padding 256加密.我正在尝试使用以下代码将数据发布到第三方银行:

<cfparam name="theKey" default="someStaticKey">
<cfset strName = leaddetail.leadlast&','&leaddetail.leadfirst />
    <cfset stFields = {requesttype = "eftaddonetimecompletetransaction"
            ,clientid = "XXXXXX"
            ,urltoredirect = "#RedirectURl#"
            ,customerid = "#leaddetail.leadid#"
            ,isdebitcardonly = "No"
            ,customername = "#strName#"
            ,customeraddress1 = "#form.billingaddress#"
            ,customercity = "#form.billingcity#"
            ,customerstate = "#form.billingstate#"
            ,customerzip = "#form.billingzip#"
            ,cardbillingaddr1 = "#form.billingaddress#"
            ,cardbillingcity = "#form.billingcity#"
            ,cardbillingstate = "#form.billingstate#"
            ,cardbillingzip = "#form.billingzip#"
            ,accounttype = "CC"
            ,name_on_card = "#form.leadname#"
            ,accountnumber = "#form.ccacctnum#"
            ,expmonth = "#Left(form.ccexpdate,2)#"
            ,expyear = "#Right(form.ccexpdate,2)#"
            ,cvvcode = "#form.ccv2#"
            ,amount = "#NumberFormat(esigninfo.esignpayamt,'9999.99')#"
            ,startdate = "#DateFormat(Now(),'YYYY-MM-DD')#"
            ,transactiontypecode …
Run Code Online (Sandbox Code Playgroud)

encryption coldfusion cryptography coldfusion-9

0
推荐指数
1
解决办法
1285
查看次数

保持函数不被定义两次

我试图在模板中定义一个函数,但有时模板被调用两次.我试过了

<cfscript>
if (not isdefined("tested"))    {

    string function tested(required string component) output="false"    {

        if (arguments.component CONTAINS "internal") return 'N/A';
    ....


 </cfscript>
Run Code Online (Sandbox Code Playgroud)

但我还是得到了

在此输入图像描述

coldfusion coldfusion-9

0
推荐指数
1
解决办法
101
查看次数

我如何用字符串中的select语句评估cfif

sel_prod_dt = "select distinct change_app_code, change_number "
          & " \<cfif NDA_check eq "
          &'"Y"' 
          &"> FROM db.tb tb"
          &"\<cfelse\>FROM db.tb2 PC\<\/cfif\>"
Run Code Online (Sandbox Code Playgroud)

我收到以下错误

语法错误,在单词'change_number'和请求结束之间需要类似名称或Unicode分隔符的标识符.

有谁可以帮助我这方面..

sql database coldfusion coldfusion-9 cfml

0
推荐指数
1
解决办法
662
查看次数

在Coldfusion中从头开始创建一个简单的单元测试框架

我知道现有的测试ColdFusion应用程序的工具(MXUnit,MockBox),但我正在创建一个自定义工具,因此需要更少的配置.

当我运行单元测试文件时,它是通过通用的"模型" 完成的,该模型从单元测试文件中检索所有函数.在每个测试函数中,我必须调用assertEquals- 但这些函数在模型中,所以我无法访问它们.

我尝试将模型本身传递给单元测试文件,因此它可以直接调用模型函数,但它不起作用,它会为测试文件添加逻辑,我不喜欢.

我也可以在测试文件中扩展模型但我必须直接调用测试文件,调用super.init(this)所以模型可以获取测试函数等.

有没有办法实现这种过程?什么是最好的选择?

coldfusion frameworks unit-testing coldfusion-9

0
推荐指数
1
解决办法
186
查看次数

按月分组查询结果

我有一个coldfusion查询结果,它只包含日期

喜欢

2015-07-14 00:00:00.0   
2015-07-22 00:00:00.0   
2015-07-24 00:00:00.0   
2015-07-27 00:00:00.0   
2015-08-04 00:00:00.0   
2015-08-05 00:00:00.0   
2015-08-15 00:00:00.0   
2015-09-01 00:00:00.0   
2015-09-02 00:00:00.0   
2015-09-21 00:00:00.0   
2015-10-14 00:00:00.0   
2015-12-10 00:00:00.0   
2016-01-13 00:00:00.0 
Run Code Online (Sandbox Code Playgroud)

我想显示基于月份对它们进行分组的查询结果

例如,作为第一列的月份名称,然后是每行的月份日期.我不知道如何在这种情况下对查询进行分组.

coldfusion coldfusion-9

0
推荐指数
1
解决办法
245
查看次数