Menu

Unable to insert records

2005-07-26
2013-03-07
  • Nobody/Anonymous

    I am using MYSQL,  everything works on my local computer ,  but as soon as I publish it to the server I can not longer create new recrods.  Every time I try I get the following error message

    AtomsFramework.SaveException: Object reference not set to an instance of an object. Inner Exception message : Object reference not set to an instance of an object. Inner Exception message : Object reference not set to an instance of an object. Inner Exception message : Object reference not set to an instance of an object. at AtomsFramework.PersistentObject.Save(PersistentObject obj, Boolean checkAssociationsRecursively) in C:\Local Files\Development Library\Framework\AtomsFramework.2.2.RC1\dotnet\CPersistentObject.vb:line 971 at AtomsFramework.PersistentObject.Save() in C:\Local Files\Development Library\Framework\AtomsFramework.2.2.RC1\dotnet\CPersistentObject.vb:line 987

    My config file looks like this ...

    <?xml version="1.0" encoding="utf-8" ?>
    <map xmlns:xsi="AToMSFramework.xsd">
        <database name="AFWatchinder" provider="C:\Local Files\Development Library\Framework\AtomsFramework.2.2.RC1\dotnet\Providers\AF_MySQL\bin\AF_MySQL.dll">
            <parameter name="name" value="shop-manager-uk" />
            <parameter name="serverName" value="localhost" />
            <parameter name="user" value="root" />
            <parameter name="password" value="ph1warm" />
            <parameter name="OIDTable" value="oid" />
            <parameter name="portNumber" value="3306" />
        </database>
        <class name="Category" table="category" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="Name" />
            <attribute name="Description" column="Description" />
            <attribute name="Keywords" column="Keywords" />
        </class>
        <class name="Shop" table="shop" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="Name" />
            <attribute name="Description" column="Description" />
            <attribute name="Sites"  />
        </class>
        <class name="site" table="site" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="Name" />
            <attribute name="webaddress" column="webaddress" />
            <attribute name="Description" column="Description" />
            <attribute name="WorldPayAccount" column="WorldPay" />
            <attribute name="V12Account" column="V12" />
            <attribute name="Shops"  />
            <attribute name="PostCodeAnywhereAccount" column="PostCodeAnywhereAccount" />
            <attribute name="PostcodeAnywhereLicense" column="PostcodeAnywhereLicense" />
            <attribute name="PostcodeAnywherePassword" column="PostcodeAnywherePassword" />
        </class>
       
        <class name="manufacturer" table="manufacturer" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="Name" />
            <attribute name="Description" column="Description" />
            <attribute name="Keywords" column="Keywords" />
        </class>
        <class name="ProductRange" table="range" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="Name" />
            <attribute name="Description" column="Description" />
            <attribute name="Keywords" column="Keywords" />
        </class>
        <class name="product" table="product" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="Name" />
            <attribute name="ShortDescription" column="ShortDescription" />
            <attribute name="LongDescription" column="LongDescription" />
            <attribute name="BuyInPrice" column="BuyInPrice" />
            <attribute name="ListPrice" column="ListPrice" />
            <attribute name="CustomerPrice" column="CustomerPrice" />
            <attribute name="QTYInStock" column="QTYInStock" />
            <attribute name="SortOrder" column="SortOrder" />
            <attribute name="CallForPricing" column="CallForPricing" />
            <attribute name="CallMessage" column="CallMessage" />
            <attribute name="Hide" column="Hide" />
            <attribute name="Keywords" column="Keywords" />
            <attribute name="ImageFileName" column="imagefilename" />
            <attribute name="Condition" column="Condition" />
            <attribute name="IDRange" column="RangeOID" />
            <attribute name="ProductRange" />
            <attribute name="IDManufacturer" column="ManufacturerOID" />
            <attribute name="ProductManufacturer" />
            <attribute name="Shops" />
            <attribute name="Campains" />
        </class>
       
        <class name="Campain" table="campain" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="RunUntil" column="RunUntil" />
            <attribute name="ImageFileName" column="imagefilename" />
            <attribute name="Description" column="Description" />
            <attribute name="Products"  />
        </class>
       
        <class name="customer" table="customer" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Title" column="title" />
            <attribute name="FirstName" column="firstname" />
            <attribute name="Surname" column="surname" />
            <attribute name="EmailAddress" column="emailaddress" find="true" />
            <attribute name="Telephone" column="telephone" />
            <attribute name="Workphone" column="workphone" />
            <attribute name="Mobile" column="mobile" />
            <attribute name="Address1" column="address1" />
            <attribute name="Address2" column="address2" />
            <attribute name="Address3" column="address3" />
            <attribute name="Town" column="town" />
            <attribute name="County" column="county" />
            <attribute name="Country" column="country" />
            <attribute name="PostalCode" column="postalcode" />
            <attribute name="IDReferral" column="refferalOID" />
        </class>
        <class name="referral" table="referral" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="name" />
            <attribute name="Description" column="description" />
        </class>
        <class name="session" table="session" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="IDCustomer" column="customeroid" />
            <attribute name="Customer" />
        </class>
        <class name="OrderHeader" table="orderheader" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Completed" column="Completed" />
            <attribute name="Closed" column="closed" />
            <attribute name="IDCustomer" column="customerid" />
            <attribute name="Customer" />
            <attribute name="OwnerOID" column="OwnerOID" />
            <attribute name="Owner" />
            <attribute name="CreatedByOID" column="CreatedByOID" />
            <attribute name="CreatedBy" />
            <attribute name="Status" column="Status" />
            <attribute name="SiteOID" column="SiteOID" />
            <attribute name="OrderSite" />
           
           
        </class>
        <class name="OrderItem" table="orderitems" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="IDOrderHeader" column="orderheaderOID" />
            <attribute name="QTY" column="qty" />
            <attribute name="ItemPrice" column="itemprice" />
            <attribute name="LinePrice" column="lineprice" />
            <attribute name="Returned" column="returned" />
            <attribute name="IDProduct" column="productOID" />
            <attribute name="Product" />
        </class>
        <class name="OrderHistory" table="orderhistory" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="ShowCustomer" column="showcustomer" />
            <attribute name="Notes" column="notes" />
            <attribute name="IDOrderHeader" column="orderheaderOID" />
        </class>
        <class name="user" table="user" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="EMailAddress" column="emailaddress" find="true" />
            <attribute name="Password" column="password" />
            <attribute name="FirstName" column="firstname" />
            <attribute name="Surname" column="surname" />
            <attribute name="TelephoneNumber" column="telephonenumber" />
            <attribute name="Colour" column="Colour" />
            <attribute name="SiteOID" column="SiteOID" />
            <attribute name="UserSite" />
        </class>

        <class name="globalsetting" table="globalsettings" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="name" find="true" />
            <attribute name="Value" column="value" />
        </class>
        <class name="Template" table="template" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="name" column="name" />
            <attribute name="ASPXPage" column="ASPXPage" />
            <attribute name="FriendlyName" column="FriendlyName" />
            <attribute name="ConversionRule" column="ConversionRule" />
        </class>
        <class name="DataBlock" table="templatedatablock" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="name" column="name" />
            <attribute name="connectionstring" column="connectionstring" />
            <attribute name="provider" column="provider" />
            <attribute name="SQLStatement" column="SQLStatement" />
        </class>
        <class name="ContentBlock" table="templatecontentblock" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="placeholderid" column="placeholderid" />
            <attribute name="headerHTML" column="headerHTML" />
            <attribute name="footerHTML" column="footerHTML" />
            <attribute name="NoResultsHTML" column="NoResultsHTML" />
            <attribute name="TemplateID" column="pageoid" />
            <attribute name="DataBlockID" column="datablockoid" />
            <attribute name="DataBlock" />
        </class>
       
        <class name="sys_menu" table="sys_menu" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="name" />
            <attribute name="LinkRef" column="linkref" />
            <attribute name="HelpText" column="helptext" />
            <attribute name="ItemCode" column="itemcode" />
            <attribute name="Icon" column="icon" />
            <attribute name="SubMenus" />
        </class>
       
        <class name="sys_menu_sub" table="sys_menu_sub" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="Name" column="name" />
            <attribute name="LinkRef" column="linkref" />
            <attribute name="HelpText" column="helptext" />
            <attribute name="ParentOID" column="parentoid" />
            <attribute name="Icon" column="icon" />
        </class>
       
        <class name="OrderPayment" table="orderpayments" database="AFWatchinder">
            <attribute name="OIDValue" column="oid" key="primary" />
            <attribute name="CreatedDate" column="CreatedDate" timestamp="true" />
            <attribute name="ModifiedDate" column="ModifiedDate" timestamp="true" />
            <attribute name="IDOrderHeader" column="orderheaderOID" />
            <attribute name="PaymentType" column="PaymentType" />
            <attribute name="PaymentReference" column="PaymentReference" />
            <attribute name="Notes" column="Notes" />
            <attribute name="Amount" column="Amount" />
            <attribute name="OwnerOID" column="OwnerOID" />
            <attribute name="Owner" />
        </class>
        <association
            fromClass="product"
            toClass="manufacturer"
            cardinality="oneToOne"
            target="ProductManufacturer"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="IDManufacturer" toAttribute="OIDValue" />
        </association>
       
        <association
            fromClass="product"
            toClass="ProductRange"
            cardinality="oneToOne"
            target="ProductRange"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="IDRange" toAttribute="OIDValue" />
        </association>
       

       
        <association fromClass="OrderHeader"
            toClass="OrderItem"
            cardinality="oneToMany"
            target="OrderItems"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="OIDValue" toAttribute="IDOrderHeader"/>
        </association>
       
        <association fromClass="OrderHeader"
            toClass="OrderPayment"
            cardinality="oneToMany"
            target="OrderPayments"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="OIDValue" toAttribute="IDOrderHeader"/>
        </association>
       
        <association fromClass="OrderHeader"
            toClass="OrderHistory"
            cardinality="oneToMany"
            target="OrderHistory"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="OIDValue" toAttribute="IDOrderHeader"/>
        </association>
       
        <association
            fromClass="OrderItem"
            toClass="product"
            cardinality="oneToOne"
            target="Product"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="IDProduct" toAttribute="OIDValue" />
        </association>
       
        <association
            fromClass="OrderHeader"
            toClass="customer"
            cardinality="oneToOne"
            target="Customer"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="IDCustomer" toAttribute="OIDValue" />
        </association>
       
       
        <association
            fromClass="OrderHeader"
            toClass="user"
            cardinality="oneToOne"
            target="CreatedBy"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="CreatedByOID" toAttribute="OIDValue" />
        </association>
       
        <association
            fromClass="OrderHeader"
            toClass="user"
            cardinality="oneToOne"
            target="Owner"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="OwnerOID" toAttribute="OIDValue" />
        </association>
       
        <association
            fromClass="OrderHeader"
            toClass="site"
            cardinality="oneToOne"
            target="OrderSite"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="SiteOID" toAttribute="OIDValue" />
        </association>
       
        <association
            fromClass="OrderPayment"
            toClass="user"
            cardinality="oneToOne"
            target="Owner"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="OwnerOID" toAttribute="OIDValue" />
        </association>
       
        <association fromClass="sys_menu"
            toClass="sys_menu_sub"
            cardinality="oneToMany"
            target="SubMenus"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="OIDValue" toAttribute="ParentOID"/>
        </association>
       
        <association
            fromClass="product"
            toClass="Category"
            cardinality="ManyToMany"
            fromClassTarget="Categories"
            toClassTarget="Products"
            retrieveAutomatic="lazy"
            deleteAutomatic="true"
            saveAutomatic="true">
            <associationTable name="productcategory">
                <fromClassKey name="OIDValue" column="productoid" />
                <toClassKey name="OIDValue" column="categoryoid" />
            </associationTable>
        </association>
       
        <association
            fromClass="product"
            toClass="Shop"
            cardinality="ManyToMany"
            fromClassTarget="Shops"
            toClassTarget="Products"
            retrieveAutomatic="lazy"
            deleteAutomatic="false"
            saveAutomatic="true">
            <associationTable name="productshops">
                <fromClassKey name="OIDValue" column="productoid" />
                <toClassKey name="OIDValue" column="shopoid" />
            </associationTable>
        </association>
       
        <association
            fromClass="site"
            toClass="Shop"
            cardinality="ManyToMany"
            fromClassTarget="SiteShops"
            toClassTarget="ShopSites"
            retrieveAutomatic="lazy"
            deleteAutomatic="true"
            saveAutomatic="true">
            <associationTable name="siteshops">
                <fromClassKey name="OIDValue" column="siteoid" />
                <toClassKey name="OIDValue" column="shopoid" />
            </associationTable>
        </association>
       
       
        <association
            fromClass="user"
            toClass="site"
            cardinality="oneToOne"
            target="UserSite"
            retrieveAutomatic="true"
            deleteAutomatic="true"
            saveAutomatic="true"
            inverse="false">
            <entry fromAttribute="SiteOID" toAttribute="OIDValue" />
        </association>
    </map>

       Order = Session("order")
                Order.SetDirtyFlag()
                Try
                    Order.Save()
                Catch ex As Exception
                    _boolsuccess = False
                    Throw New Exception(Order.ToString & "    -" & ex.ToString)
                End Try
            Else
                _boolsuccess = False
            End If
            Return _boolsuccess

    Can anyone help me,  this is driving me mad !

    Thanks in advance

    Cheers

    Jon

     
    • Richard Banks

      Richard Banks - 2005-08-06

      I'm assuming that the MySQL provider has been installed on the server, and that the .DLL is actually located at C:\Local Files\Development Library\Framework\AtomsFramework.2.2.RC1\dotnet\Providers\AF_MySQL\bin\AF_MySQL.dll

      Have you been able to retrieve any objects before the save.

      Can you attach to the process on the server via VS.NET and debug it?  If not, try dumping the stack trace from the exception to see where the exception was originally thrown.
      If you can't get a stack I can only suggest that you insert a whole bunch of console.writeline statements in the code to try and figure out where things have gone wrong.

      Sorry I can't help further.

      - Richard.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.