Level Extreme platform
Subscription
Corporate profile
Products & Services
Support
Legal
Français
What wrong with this
Message
General information
Forum:
Visual FoxPro
Category:
Visual FoxPro and .NET
Miscellaneous
Thread ID:
00660525
Message ID:
00660779
Views:
10
Cathi

I was trying Example 2: Accessing a Visual FoxPro COM Component

here's what i did

i created a visual foxpro project customer. and in the main program i placed this code.
DEFINE CLASS Customer AS SESSION OLEPUBLIC
    FUNCTION Init()
      This.Load()
    ENDFUNC
    
  * Open database and USE the customer table.
    FUNCTION Load()
      * Open the TESTDATA database.
      LOCAL lcDatabaseLocation as Character
      LOCAL lcTableLocation as Character
      IF NOT DBUSED('testdata')
        lcDatabaseLocation = _SAMPLES + '\DATA\testdata'
        OPEN DATABASE (lcDatabaseLocation) SHARED
      ENDIF
      * Use the customer table.
      lcTableLocation = _SAMPLES + '\DATA\' + This.GetCursorName()
    USE (lcTableLocation) NODATA SHARED
    ENDFUNC

  * Find a customer record based on a customer ID passed in 
      as a parameter.
    FUNCTION Fetch()
      LPARAMETERS tcCustID as Character
      LOCAL lcAlias
      lcAlias = This.GetCursorName()
      SELECT (lcAlias)
      LOCATE FOR Cust_ID = tcCustID
      RETURN FOUND()
    ENDFUNC

  * Close the customer table.
    FUNCTION Destroy()
      LOCAL lcCursor as Character
      lcCursor = This.GetCursorName()
      USE IN (lcCursor)
    ENDFUNC
    
  * Reference to which table is being USEd.
    FUNCTION GetCursorName() as String
      RETURN "Customer"
    ENDFUNC

  * This method returns the customer's credit limit.  
   The customer ID is passed in as a parameter.
    FUNCTION GetCreditLimit(tcCustID as Character) as Currency
      LOCAL lyCredLimit as Currency
      * Try and find customer record in the customer table.
      IF This.Fetch(tcCustID)
        * Customer found.  Return the credit limit from the 
         MaxOrdAmt field in the customer table.
        lyCredLimit = EVALUATE(This.GetCursorName() + '.MaxOrdAmt')
      ELSE
        * Customer not found.  Return -1 to the calling program.
        lyCredLimit = -1
      ENDIF
      RETURN lyCredLimit
    ENDFUNC

ENDDEFINE

I created a mutlithread com dll. Is this Correct ??

Then i added a reference in my webproject to that dll. at this time there was a message

---------------------------
Microsoft Development Environment
---------------------------
Could not find a primary interop assembly for the COM component 'customer Type Library'. A primary interop assembly is not registered for this type library. Would you like to have a wrapper generated for you?
---------------------------
Yes No Help
---------------------------

I said yes. Is this correct ?

then i run the program but this is what i got,sorry its too long .

Server Error in '/WebApplication2' Application.
--------------------------------------------------------------------------------

Configuration Error
Description: An error occurred during the processing of a configuration file required to service this request. Please review the specific error details below and modify your configuration file appropriately.

Parser Error Message: File or assembly name System.Web, or one of its dependencies, was not found.

Source Error:


Line 54: -->
Line 55:
Line 56:
Line 57:
Line 58:


Source File: c:\inetpub\wwwroot\WebApplication2\web.config Line: 56

Assembly Load Trace: The following information can be helpful to determine why the assembly 'System.Web' could not be loaded.


=== Pre-bind state information ===
LOG: DisplayName = System.Web
(Partial)
LOG: Appbase = file:///c:/inetpub/wwwroot/WebApplication2
LOG: Initial PrivatePath = bin
Calling assembly : (Unknown).
===

LOG: Policy not being applied to reference at this time (private, custom, partial, or location-based assembly bind).
LOG: Post-policy reference: System.Web
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication2/37f71cbe/939c5907/System.Web.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication2/37f71cbe/939c5907/System.Web/System.Web.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/WebApplication2/bin/System.Web.DLL.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/WebApplication2/bin/System.Web/System.Web.DLL.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication2/37f71cbe/939c5907/System.Web.EXE.
LOG: Attempting download of new URL file:///C:/WINNT/Microsoft.NET/Framework/v1.0.3705/Temporary ASP.NET Files/webapplication2/37f71cbe/939c5907/System.Web/System.Web.EXE.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/WebApplication2/bin/System.Web.EXE.
LOG: Attempting download of new URL file:///c:/inetpub/wwwroot/WebApplication2/bin/System.Web/System.Web.EXE.




--------------------------------------------------------------------------------
Version Information: Microsoft .NET Framework Version:1.0.3705.209; ASP.NET Version:1.0.3705.0
Previous
Next
Reply
Map
View

Click here to load this message in the networking platform