I have a problem with CF code, and I assume it is because I am new to ColdFusion. I've searched the Web, the Adobe pages, the Forums here, tutorials, etc... I just can't find the answer to what I imagine to be a fundamental of CF.

I just inherited CF code that queries a CSV "database", searches for any fields in the database that match user-inputted text, and returns any records containing matched text. This code was on another server and it worked fine, but on its new server (which does have full CF support) I cannot get records returned. I am assuming that I simply do not know either what to name the CSV or where to store it, or both.

Code details:

The initial CF form, "search.cfm", takes user-inputted text and calls "searchaction2.cfm", as referenced by

<cfform name="form" method="post" action="searchaction2.cfm" onsubmit="return ValidateForm();">

However, when I submit this form, I only get an error message that points to these lines in "searchaction2.cfm":

<cfquery name="first" datasource="cmp_pama">
SELECT * FROM Bib_New WHERE id=id 
<cfif #form.searchText1# is not "">

So, what do I name the CSV or where do I store it? In the properly-organized site files I was given, the name/location isn't working. Moving it into the same directory as these search files didn't work. Renaming it to "cmp_pama", "cmp_pama.csv", "Bib_New", and "Bib_New.csv" all didn't work (though honestly I may have missed one of those in my trials). I'm sure I'm missing something that would be obvious with experience....

Thank you very much for your help, even for only reading my plea. It is greatly appreciated!

Recommended Answers

All 3 Replies

You need to create the datasource in the ColdFusion administrator if you have access to it.

Thank you greatly for writing! Am looking into that now... from "if you have access to it" that means a call in to the site's hosting company to find out.
Will follow-up either way. Thank you!

For finality:
Seems "administrator if you have access to it" was the tip I needed... Called hosting company's tech support, they walked me through with what I needed. Wasn't just a datasource issue, was uploading the database to the server, etc etc.... Thanks for the help!! :-)

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, learning, and sharing knowledge.