Link to home
Start Free TrialLog in
Avatar of Qsorb
QsorbFlag for United States of America

asked on

Cannot save cfoutput query to database or save using cffile

I cannot seem to save this mixed text to my sql 2000 database:

This is what I'm trying to save:
// -----------------------------------------------------------------------------------
{src:"./313.jpg",title:"Justices toss out government fines ",href:"/bnews/story.htm?id=313"}, {src:"./312.jpg",title:"Aimee Copeland leaves Ga. hospital ",href:"/bnews/story.htm?id=312"}, {src:"./311.jpg",title:"grandma steals $97,000 From Grands",href:"/bnews/story.htm?id=311"}, {src:"./310.jpg",title:"Tom Cruise, Scientology And The Odd",href:"/bnews/story.htm?id=310"}, {src:"./309.jpg",title:"California Homeless Man Gets Shelte",href:"/bnews/story.htm?id=309"}, {src:"./308.jpg",title:"7-year-old girl, Heaven, shot dead ",href:"/bnews/story.htm?id=308"}, {src:"./307.jpg",title:"Valerie Bruno Cuts Off Daughter Kay",href:"/bnews/story.htm?id=307"}, {src:"./306.jpg",title:"Adam Longoria, Alicia DeBolts Murde",href:"/bnews/story.htm?id=306"}, {src:"./305.jpg",title:"Cadaver dogs join search for 4-year",href:"/bnews/story.htm?id=305"}, {src:"./304.jpg",title:"Police Rescue Severely Malnourished",href:"/bnews/story.htm?id=304"}
// -----------------------------------------------------------------------------------
Data type varchar length 7000. I've tried every data type I can think of and when attempting to manually insert into the sql table, I get the error:

"The value you entered is not consistant with the data type or length of the column, or over grid buffer limit."

So, I tried to save the text to my hard drive via CFFILE, but also got an error:

"Invalid CFML construct ..."

All I want to do is save the file as it is. I understand it has lot of non-standard characters but what's the  problem? Do I need to use some kind of binary type or what? This is all  pretty frustrating.

BACKGROUND:
I'm using the WOWSLIDER carousel program. The idea is to show an image associated with the news, show the title of the story, and provide a link to the story. Most of these are from news feeds,  and everything,  including images, are saved on our server. So, I thought it best to use my database and cfquery to insert which images to display so that the carousel is self perpetuating as the news changes. That  means I need to change the script.js file, on the fly, and cfinsert parts into the middle of the file and write it to the database or to hard drive so it can be used again.

fyi, here's the script I need to modify:

// -----------------------------------------------------------------------------------
// http://wowslider.com/ - WOW Slider 2.3
function ws_fade(c,a,b){var e=jQuery;var d=e("ul",b);var f={position:"absolute",left:0,top:0,width:"100%",height:"100%"};this.go=function(g,h){var i=e(a.get(g)).clone().css(f).hide().appendTo(b);if(!c.noCross){var j=e(a.get(h)).clone().css(f).appendTo(b);d.hide();j.fadeOut(c.duration,function(){j.remove()})}i.fadeIn(c.duration,function(){d.css({left:-g+"00%"}).show();i.remove()});return g}};// -----------------------------------------------------------------------------------

jQuery("#wowslider-container1").wowSlider({effect:"fade",prev:"",next:"",duration:20*100,delay:20*100,width:400,height:250,autoPlay:true,stopOnHover:false,loop:false,bullets:0,caption:false,controls:true,logo:"engine1/loading.gif",images:[{src:"./312.jpg",title:"312",href:"/news/main/national/312"},{src:"./311.jpg",title:"311",href:"/news/main/national/311"},{src:"./310.jpg",title:"310",href:"/news/main/national/310"}]});
// -----------------------------------------------------------------------------------

I asum can can break this  up into three pieces, the image numbers, titles, and links will be replaced by my database coldfusion variables.

Maybe I'm looking at this in the wrong manner so could use some fresh ideas, and if not, let me know why I cannot save this to my database or using cffile to hard drive.


Suggestions?
{src:"./313.jpg",title:"Justices toss out government fines ",href:"/bnews/story.htm?id=313"}, {src:"./312.jpg",title:"Aimee Copeland leaves Ga. hospital ",href:"/bnews/story.htm?id=312"}, {src:"./311.jpg",title:"grandma steals $97,000 From Grands",href:"/bnews/story.htm?id=311"}, {src:"./310.jpg",title:"Tom Cruise, Scientology And The Odd",href:"/bnews/story.htm?id=310"}, {src:"./309.jpg",title:"California Homeless Man Gets Shelte",href:"/bnews/story.htm?id=309"}, {src:"./308.jpg",title:"7-year-old girl, Heaven, shot dead ",href:"/bnews/story.htm?id=308"}, {src:"./307.jpg",title:"Valerie Bruno Cuts Off Daughter Kay",href:"/bnews/story.htm?id=307"}, {src:"./306.jpg",title:"Adam Longoria, Alicia DeBolts Murde",href:"/bnews/story.htm?id=306"}, {src:"./305.jpg",title:"Cadaver dogs join search for 4-year",href:"/bnews/story.htm?id=305"}, {src:"./304.jpg",title:"Police Rescue Severely Malnourished",href:"/bnews/story.htm?id=304"}

Open in new window

SOLUTION
Avatar of Coast Line
Coast Line
Flag of Canada image

Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Qsorb

ASKER

Thanks but my first line clearly indicated I'm using sql 2000 database.

Nvarchar will not work and I don't believe nvarchar(max) is NOT available for SQL 2000. And I'm not going to upgrade.

This isn't a  matter of too much data. Surely some data type can handle JavaScript code.

And if not, then I need to save with CFFILE, but again, I cannot.

Round and round ....
so how u are saving the file

can u show me some code for this
ASKER CERTIFIED SOLUTION
Link to home
membership
This solution is only available to members.
To access this solution, you must be a member of Experts Exchange.
Start Free Trial
Avatar of Qsorb

ASKER

Working on this now and will get back to you soon ...
Avatar of Qsorb

ASKER

Looks like my main problem was using double quotes in the insert code instead of single quotes. If I had posted that code. But then again, I could not insert it directly into sql. My lesson learned.

But both of you got me to thinking and also to use  "cfsavecontent variable .."

Thanks so much.