Darren:
I'm just starting to use structures in CF too, so I'm by no means an
expert, but the code appended below is what I've used to address the
task you asked about -- hope it helps !
-Gerry
Gerard T. Pauline
Mgr, Internet/DB Applications
Computer Systems, DoIT
Pace University
================================================================
<CFQUERY NAME="Info" DATASOURCE="LSN" MAXROWS="100">
SELECT student_ID, last_name, first_name
FROM Students
ORDER BY last_name, first_name;
</CFQUERY>
<CFSET Student = ArrayNew(1)>
<CFSET Idx = 0>
<CFLOOP QUERY="Info">
<CFSET Idx = Idx + 1 >
<CFSET Student[Idx] = StructNew()>
<CFSET Student[Idx].ID = Info.Student_ID>
<CFSET Student[Idx].LN = Info.Last_Name>
<CFSET Student[Idx].FN = Info.First_Name>
</CFLOOP>
<TABLE BORDER="3">
<CFOUTPUT>
<CFLOOP INDEX="T" FROM="1" TO="#ArrayLen(Student)#">
<CFIF Student[T].ID GTE 90>
<TR>
<TD>#Student[T].ID#</TD>
<TD>#Student[T].LN#</TD>
<TD>#Student[T].FN#</TD>
</TR>
</CFIF>
</CFLOOP>
</CFOUTPUT>
</TABLE>
================================================================
Darren Adams wrote:
>
> Can anyone lend me a hand ?
>
> I am trying to store one database in an array of structures then insert it
> into another database.
>
> I am only using one field at the moment but, there will be 9 that I want to
> copy over.
>
> What I am trying to do is to take PressReleaseHeader from the
> pressreleasetable.
>
> But it keep giving me errors.
>
> <!--- query the old newsroom database--->
>
> <cfquery name="news" datasource="newsadmin" dbtype="ODBC">
> select * from pressreleasetable
> ORDER by pressreleasedate DESC
> </cfquery>
>
> <!---Setup an array with a structure --->
>
> <cfset oldnews = ArrayNew()>
> <cfset oldnews[1] = StructNew()>
> <!---add others here later e.g. prsub,prcontent,date etc... --->
>
> <Cfoutput query="news">
> <cfset oldnews[news.currentrow].headline = #pressreleaseheader#>
> </cfoutput>
>
> 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/[email protected]/
Unsubscribe: http://www.houseoffusion.com/index.cfm?sidebar=lists