Error when query table from custom database

Hi all,

I have a custom database(not company database) to store information to be retrieve by all companies in a custom form. I am able to query its table using plain query in MSSQL Management Studio.

With Sage 200, I am able to make a connection to the database using Sage.ObjectStore.ConnectionData. I make persistent object class for the tables in custom database using Sage 200 ObjectStore Builder.

But not able to add or select from its table due to "Sage.ObjectStore.DatabaseException: Counter Table is missing or corrupt ---> Sage.ObjectStore.MissingTableException: Counter Table is missing or corrupt". 

Full error as below. 

Sage.ObjectStore.DatabaseException: Counter Table is missing or corrupt ---> Sage.ObjectStore.MissingTableException: Counter Table is missing or corrupt
   at Sage.ObjectStore.Counter.GetPage(Int32 pageSize)
   at Sage.ObjectStore.PrimaryKeyGenerator.get_NextPrimaryKey()
   at Sage.ObjectStore.PersistentObject.GenerateNextPrimaryKey()
   at Sage.ObjectStore.Database.GetInsertCommand(IDbCommand dbCommand, List`1 parameters, IDatabaseObject src, List`1 fields, String tableName, Field primaryKeyField)
   at Sage.ObjectStore.Database.Insert(IDatabaseObject src, List`1 fields, String tableName, Field primaryKeyField)
   --- End of inner exception stack trace ---
   at Sage.Common.Exceptions.ExceptionManager.Throw(Exception e)
   at Sage.ObjectStore.Database.Insert(IDatabaseObject src, List`1 fields, String tableName, Field primaryKeyField)
   at Sage.ObjectStore.Database.Insert(IDatabaseObject src)
   at Sage.ObjectStore.PersistentObject.AddNewPrivate()
   at Sage.ObjectStore.PersistentObject.AddNewInternal()
   at Sage.ObjectStore.PersistentObject.AddNew()
   at Sage.ObjectStore.PersistentObject.Add()

Is Sage.ObjectStore.PersistentObject can only be use if we are in the company database?

Parents
  • 0

    Interesting, i have never thought to try this,  

    To get over this issue, all you would need to do is add a table called "Counter" to your custom database. find the counter table in a sage 200 database, right click and choose "Script table as " the "Create to" then "new query window"

    remove the "Use" statement at the top, and then run the script against you custom table.

    this will resolve the missing table issue, whether or not it will make it work? i would be interested to know

Reply
  • 0

    Interesting, i have never thought to try this,  

    To get over this issue, all you would need to do is add a table called "Counter" to your custom database. find the counter table in a sage 200 database, right click and choose "Script table as " the "Create to" then "new query window"

    remove the "Use" statement at the top, and then run the script against you custom table.

    this will resolve the missing table issue, whether or not it will make it work? i would be interested to know

Children