Hello Folks,
Can any of you eagle eyed people spot why I am getting a "ODBC Error Code =
37000 (Syntax error or access violation)" error when I run this.
I had it working earlier and managed ot output all the oldnews.headline into
my database but, I added a few more fields to the sql and now it had
buggered it all up.
This is bugging me, any help will be very appreciated.
Cheers
Daz
<cfquery name="news" datasource="newsadmin" dbtype="ODBC">
select * from pressreleasetable
<!---where live = 1--->
ORDER by pressreleasedate DESC
</cfquery>
<!---Setup an array with a structure --->
<cfset oldnews = ArrayNew(1)>
<Cfoutput query="news">
<cfset oldnews[news.currentrow] = StructNew()>
<cfset oldnews[news.currentrow].headline = #pressreleaseheader#>
<cfset oldnews[news.currentrow].subtitle = #prsub#>
<cfset oldnews[news.currentrow].body = #pressreleasecontent#>
<cfset oldnews[news.currentrow].date = #pressreleasedate#>
<cfset oldnews[news.currentrow].expdate = #expdate#>
<cfset oldnews[news.currentrow].country = #pressreleasecountryname#>
<cfset oldnews[news.currentrow].live = #live#>
<cfset oldnews[news.currentrow].author = #pressreleaseauthor#>
</cfoutput>
<!---<cf_objectdump object="#oldnews#">--->
<!---loop throught the array and then insert into the database --->
<cfloop from="1" to="#ArrayLen(oldnews)#" index="i">
<cfquery name="newnews" datasource="cosmos1" dbtype="ODBC">
insert into pressoffice
(headline)<!---,subtitle,body,date,expdate),country,live,author--->
Values
('#oldnews[i].headline#')
<!---,'#oldnews[i].subtitle#','#oldnews[i].body#','#oldnews[i].date#','#oldn
ews[i].expdate#'),
'#oldnews[i].country#','#oldnews[i].live#','#oldnews[i].author#'--->
</cfquery>
</cfloop>
Darren Adams
Web Developer
Marketing Department
Systems Union
Office: 01252 55 6220
Mobile: 07714 817 038
Email: [EMAIL PROTECTED]
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Structure your ColdFusion code with Fusebox. Get the official book at
http://www.fusionauthority.com/bkinfo.cfm
Archives: http://www.mail-archive.com/cf-talk@houseoffusion.com/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists