Plateforme Level Extreme
Abonnement
Profil corporatif
Produits & Services
Support
Légal
English
File Not Found
Message
Information générale
Forum:
Visual FoxPro
Catégorie:
Crystal Reports
Titre:
Divers
Thread ID:
00769694
Message ID:
00825561
Vues:
18
>>Hi Eric,
>>
>>Did you ever find a solution for this problem. I recently upgraded from Crystal Reports 8.5 to version 9 and I'm trying to access Fox2.x tables and I get the "Logon Failed" message when the viewer trys to display the report. This message occurs during the oleCRViewer.ViewReport() method is called.
>>
>>I'm basically going through the same process you described where I set the new table location to the runtime location.
>>
>>Any help on this would be greatly appreciated.
>>
>>Thanks,
>>
>>James
>
>Here is some code we use which is a hacked version of the settableinfo method from Kirtland Associates Crysrtal Report Engine. Basically the only requirement here is that the runtime cursor is the same name as the 2.6 table you used to design the report. You will need to save the table names and remove them as well.
>
>BTW, I used to live in Round Rock.
>
>
>lparameters oReport
>local lnIndex, lcTable, lnRow, lnTableCount, lcUniqueName, lcTempCursorName, ;
>	  loSect, loRpt, loSubRpt
>
>if vartype(oReport) = "O"
>   if !directory(This.cOutputPath)
>       md (This.cOutputPath)
>   endif
>
>   *---------------------------------------------------
>   * Handle subreports
>   * CR doesn't currently (as of v8.5) support
>   * subreports more than one level deep.
>   * But if it ever does, this should still work.
>   *---------------------------------------------------
>
>   for each loSect in oReport.Sections
>       for each loRpt in loSect.ReportObjects
>           if loRpt.Kind = 5						&& Subreport
>              loSubRpt = oReport.OpenSubReport(loRpt.SubReportName)
>              This.SetTableInfo(loSubRpt)
>           endif
>       endfor
>   endfor
>
>   *-------------------------------------------------------
>   * Run through all of the tables used in this report
>   * and search for a matching cursor in This.aRptCursors
>   * If one is found, copy the cursor to a temporary table
>   * then tell CR to point to that table instead.
>   *-------------------------------------------------------
>   *!* I shredded most of the unnecessary crap here.  EJK
>   *!* There is no need to add cursors from the report GUI since we
>   *!* loop through the table collection anyway. So just make sure any
>   *!* table in the report or subreports has an active/open cursor of
>   *!* the same name as the table used to design the report layout.
>
>   	lnTableCount = oReport.Database.Tables.Count
>
>	for lnIndex = 1 to lnTableCount
>		lcUniqueName = right(sys(2015),9)
>	   	lcTempCursorName = addbs(This.cOutputPath) + lcUniqueName + ".dbf"
>	   	lcTable = oReport.Database.Tables.Item[lnIndex].Name
>		if used(lcTable)
>			select (lcTable)
>			
>			*!* If the temporary table already exists, remove it.
>	        if file(lcTempCursorName)
>	        	erase file (addbs(This.cOutputPath) + lcUniqueName)
>	        endif
>	
>	        *!* Create a DBF out of the cursor, and get CR to use that
>	        copy to (lcTempCursorName) type fox2x
>	
>	        use in select(lcUniqueName)
>	
>	        *!* Set the data source to the temporary table
>	        oReport.Database.Tables(lnIndex).SetTableLocation(lcTempCursorName, lcUniqueName, "")
>	        oReport.discardsaveddata()
>	    endif
>	endfor
>
>	if This.lAutoVerify
>    	oReport.Database.Verify()
>   	endif
>endif
>
Hey Eric,

Thanks for the response and for sharing your code. Actually, I fixed the problem about an hour after I posted this message. The only thing I had to change was to add the file extension to the table name. The table that I create will be the same name, it is the location that changes in my case. The following is the code I use.

How long ago did you live in Round Rock? If you don't mind me asking, what company did you work for in the Austin area? How long have you been in Thailand?

Thanks again!

James
         .
         .
         .

	loDatabase = .oCrystalReport.Database
	if inlist(.nReportDataOption,2,3) and !empty(.cTempPath)
		* Set the database location.
		with loDatabase.Tables
			for each loTable in loDatabase.Tables
				lcTableName = justfname(loTable.Location) 
				loTable.Location = This.cTempPath + lcTableName + '.DBF'
			endfor		
		endwith
	endif	
		
	* Verify the Database
	loDatabase.Verify()
          
         .
         .
         .
James Moore
Owner/Developer
Ministry Tracking Software, Inc.
www.youthtrack.com
Précédent
Suivant
Répondre
Fil
Voir

Click here to load this message in the networking platform