Copy link to clipboard
Copied
I have set up a purchase order system using dreamweaver and my own PC as a test server. The system works great. When i transfer it to the webHosing service, I get an error as indicated in the subject line of this post. I am running CF8 on my test server and the web host is using CF9. The server error log shows "
"Error","jrpp-33671","05/04/15","06:18:52","Name","'' The specific sequence of files included or processed is: D:\home\batt26.com\wwwroot\sch\POinsert.cfm, line: 64 "
at cfPOinsert2ecfm1666762724.runPage(D:\home\batt26.com\wwwroot\sch\POinsert.cfm:64)
As far as i can find from extensive googling (is that a word) it is likely a database problem. I am using Microsoft access. What is strange is that it runs line 64 and completes the data insert before it throws this error.
Below is my code, i have underlined the line in question:
<cfparam name="FORM.vend_nme" default="1">
<cfparam name="FORM.job_nme" default="1">
<cfparam name="FORM.newVendID" default="1503004">
<cfquery name="rs_vend" datasource="db_sch">
SELECT *
FROM tbl_vend
WHERE vend_recStatus ='a' OR vend_recStatus = 'u'
ORDER BY newVendID DESC
</cfquery>
<cfquery name="rs_job" datasource="db_sch">
SELECT *
FROM tbl_job
ORDER BY newJobid DESC
</cfquery>
<cfquery name="rs_allPOs" datasource="db_sch">
SELECT *
FROM tbl_po
ORDER BY po_numbr DESC
</cfquery>
<cfset todayDate = now()>
<cfif len(trim(rs_allPOs.po_numbr))NEQ 0>
<cfset lastPO = #right(rs_allPOs.po_numbr,4)#>
<cfelse>
<cfset lastPO = 0>
</cfif>
<cfset form.po_numbr ="P" & DateFormat(todayDate,"yymm") & numberFormat((lastPO+1),'0000')><!---set newVendID to yydd and last vend_id from table +1 to get newVendID--->
<!---check to see if a new vendor is being created--->
<cfif len(trim(form.vend_nme)) NEQ 0>
<cfset form.vend_creatBy = #Session.MM_userID#>
<cfif len(trim(rs_vend.newVendID))NEQ 0>
<cfset lastVendID = #right(rs_vend.newVendID,4)#>
<cfelse>
<cfset lastVendID = 0>
</cfif>
<cfset form.newVendID = 'V' & DateFormat(todayDate,"yymm") & numberFormat((lastVendID+1),'0000')><!---set newVendID to yydd and last vend_id from table +1 to get newVendID--->
line 64 <cfinsert datasource="db_sch" dbtype="ODBC" dbname="sch_po" tablename="tbl_vend" formfields=" newVendID,vend_nme,vend_creatBy">
</cfif>
<!---check to see if a new job is being created--->
<cfif len(trim(form.job_nme)) NEQ 0>
<cfset form.job_creatBy = #Session.MM_userID#>
<cfif len(trim(rs_job.newJobID))NEQ 0>
<cfset lastJobID = #right(rs_Job.newJobID,4)#>
<cfelse>
<cfset lastJobID = 0>
</cfif>
<cfset form.newJobID = 'J' & DateFormat(todayDate,"yymm") & numberFormat((lastJobID+1),'0000')><!---set newJobID to yydd and last job_id from table +1 to get newJobID--->
<cfinsert datasource="db_sch" dbtype="ODBC" dbname="sch_po" tablename="tbl_job" formfields="job_id, newJobID, job_nme, job_creatBy">
</cfif>
<cfif ((len(trim(form.job_nme)) NEQ 0) OR (len(trim(form.vend_nme)) NEQ 0))>
</cfif>
<cfif len(trim(form.vend_nme)) NEQ 0>
<cfquery name="rs_vend1" datasource="db_sch">
SELECT newVendID, vend_nme
FROM tbl_vend
WHERE newVendID = <cfqueryparam value="#FORM.newVendID#" cfsqltype="cf_sql_clob" maxlength="255">
</cfquery>
<cfset form.newVendID = rs_vend1.newvendid>
</cfif>
<cfif len(trim(form.job_nme)) NEQ 0>
<cfquery name="rs_job1" datasource="db_sch">
SELECT job_id, newJobID, job_nme
FROM tbl_job
WHERE job_nme = <cfqueryparam value="#FORM.job_nme#" cfsqltype="cf_sql_clob" maxlength="255">
ORDER BY job_id DESC
</cfquery>
<cfset form.newjob_id = rs_job1.newJobID>
</cfif>
<cfinsert datasource="db_sch" dbtype="ODBC" tablename="tbl_po" formfields="newJobID,emp_req,newVendID,purch_amt,po_note,po_entby,po_numbr">
<cfquery name="rs_newPO" datasource="db_sch">
SELECT *
FROM qry_po
ORDER BY po_id DESC
</cfquery>
<cfquery name="rs_allPOs" datasource="db_sch">
SELECT *
FROM tbl_po
</cfquery>
<cfquery name="rs_users" datasource="db_sch">
SELECT *
FROM tbl_emp
WHERE emp_id = #form.emp_req#
</cfquery>
<!doctype html>
<html>
<head>
<meta charset="UTF-8">
<title>Untitled Document</title>
<link href="mobile.css" rel="stylesheet" type="text/css">
</head>
<p align="center"><a href="menu.cfm" class="menuBar" >Home</a> </p>
<p> </p>
<table width="450" border="1" align="center" class="mobile">
<tr>
<td width="144">PO Number:</td>
<td width="290"><cfoutput><span class="red">#form.po_numbr#</span></cfoutput></td>
</tr>
<tr>
<td>Job:</td>
<td><cfoutput>#rs_newPO.job_nme#</cfoutput></td>
</tr>
<tr>
<td>Vendor:</td>
<td><cfoutput>#rs_newPO.vend_nme#</cfoutput></td>
</tr>
<tr>
<td>Issued To:</td>
<td><cfoutput>#rs_newPO.Requested_by#</cfoutput></td>
</tr>
<tr>
<td>Approx. amount:</td>
<td><cfoutput></cfoutput><cfoutput>#rs_newPO.purch_amt#</cfoutput></td>
</tr>
<tr>
<td> </td>
<td> </td>
</tr>
</table>
<!---<cfif isdefined ("rs_users.cell_ph")>
<cfset textTo = ((rs_users.cell_ph)&(rs_users.cell_carrier))>
<cfmail to="#textTo#" from="Purchase Order" subject="" replyto="New Purchase Order" server="mail.batt26.com" port="26" username="noreply@batt26.com" password="Battalion26" mailerid="Battalion 26">
<cfoutput>Job Name: #rs_newPO.job_nme#, Vendor: #rs_newPO.vend_nme#, Purchase Order Number: #rs_newPO.PO_numbr#"</cfoutput>
</cfmail>
</cfif>
</p>
<p> </p>
<p> </p>
<cfoutput>#textTo#</cfoutput>--->
</body>
</html>
Copy link to clipboard
Copied
My guess would be that the form fields used in the cfinsert tag do not all exists. Also, it appears from what you posted that there is a preceding space in the field list -- this may be causing an issue.
My preference is to not use cfinsert because of unknown behaviors like these. I prefer to use cfquery for everything and write my own SQL code with cfqueryparam.