Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations sizbut on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Database field names 1

Status
Not open for further replies.

Duke383

Technical User
May 16, 2000
5
US
I had a Oracle database file sent to me in CSV format.  I brought this file into EXCEl and save it as an EXCEL file.  I then imported it into ACCESS using the exiting field names (which were the names in the first row).  I then created a <CFTREE> from the ACCESS database. No real problems.  The field names contained spaces and apostrophes and <CFQUERY> and <CFTREE> seemed to allow this with double quotes and commas in the right place.  The problem I have occurs when I want to use this data to fill out a form.  After I do a <CFQUERY> and then want to <CFSET> a variable to the <CFQUERY> output <CFSET "fieldnames" = qry.field name's> I get an error.  I know one solution is to go to ACCESS and rename all the fields removing spacing and apostrophes.  But if I have to import on a regular basis this is a pain.  Does anyone have a solution for a newbie like me.  James
 
If the fieldnames themselves wouldn't change, you could alias them as in:<br><br>&lt;CFQUERY NAME=qryName&quot; DATASOURCE=&quot;dts&quot;&gt;<br>SELECT [First Name] AS FirstName, [Last Name] AS LastName<br>FROM TabelWithSpaces<br>&lt;/CFQUERY&gt;<br><br>In the CFOUTPUT tag you could then just reference the alias<br>&lt;CFOUTPUT QUERY=qryName&gt;<br>#FirstName#, #LastName#<br>&lt;/CFOUTPUT&gt;<br><br>Hope this helps,<br><br>Brommrrrr<br><br>
 
This looks like it could work.&nbsp;&nbsp;I will definitely try it out.&nbsp;&nbsp;THANKS!!! James
 
Again, THANKS!&nbsp;&nbsp;The use of aliases work.&nbsp;&nbsp;James
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top