Gibraltar Support

Start a new topic

How to change pagesize programmatically?

On this page:

... it says "You may change this at anytime" .. ok, but that property is read-only... so how do I change it? Can't seem to find out... The only property I can set is the PageSize in the connection that is used when creating a new database, but I want to upgrade an old one...

You change it by doing a Pack operation.  Since it requires rewriting the file to change the page size its an argument to the Pack operation.  You can do this via the API or use DataBuilder to do it.

Oh, I see.. the VistaDBConnection.PackDatabase() that I used didn't take such a parameter, but I see now that IVistaDBDDA.PackDatabase() does!

Thank you!!

Yes, one of the overloads of IVistaDBDDA.PackDatabase(...) and one of the overloads of the static VistaDBConnection.PackDatabase(...) method each include parameters for newEncryptionKeyString, newPageSize, newLCID, and newCaseSensitive to specify potentially new values for these properties which must be specified when the database is first created (or is recreated by a pack).

In general, if you already have an IVistaDBDDA instance open (or will otherwise need one), its PackDatabase methods are a little more direct.  If you don't (such as you're not using the DDA API), you can just use the static VistaDBConnection overloads of PackDatabase which will open their own IVistaDBDDA instance to perform the PackDatabase and then dispose of it automatically.

Login to post a comment