18.01.2013 Views

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

LotusScript for Visual Basic Programmers - IBM Redbooks

SHOW MORE
SHOW LESS

You also want an ePaper? Increase the reach of your titles

YUMPU automatically turns print PDFs into web optimized ePapers that Google loves.

HTDatabaseSetProperty: Assigns a value to a database-level property.<br />

The type of the data is indicated by the property. When setting the value of<br />

properties, which are inherited by open indices, the new value has no effect<br />

on currently open indices.<br />

Example<br />

The following example sets the title of the database.<br />

Dim hgdatabase As Long<br />

Dim hgstatus As Long<br />

hgstatus = HTInit(0)<br />

hgstatus = HTDatabaseOpen("", "test.nsf", 0&, hgdatabase)<br />

hgstatus = HTDatabaseSetProperty(hgdatabase,<br />

HTDATABASE_TITLE, ByVal "New Title")<br />

hgstatus = HTDatabaseClose(hgdatabase, HTDBCLOSEF_SAVE_DOCS)<br />

hgstatus = HTTerm(0)<br />

Following is an explanation of the code:<br />

We declare an hgdatabase variable that references a Notes database. In<br />

HiTest, we present a Notes database handle as long.<br />

Dim hgdatabase As Long<br />

We declare an hgstatus variable. All the status codes we get later will be<br />

put in the variable.<br />

Dim hgstatus As Long<br />

For every HiTest application, we must initialize the Notes session as a first<br />

step. Other functions can only be called after session initialization. If the<br />

initialize is unsuccessful, it will return either HTFAIL_HITEST_VERSION<br />

(program built with incompatible HiTest API version) or<br />

HTFAIL_NOTES_VERSION (the HiTest API requires Notes Release 3.0 or<br />

higher) to hgstatus.<br />

hgstatus = HTInit(0)<br />

We open the TEST database, which is already on the local server. This<br />

returns a database handle, a long value to the hgdatabase variable. 0&<br />

refers to the dbopen flag. If the database cannot open, a failure notification<br />

(database does not exist) will be returned to hgstatus.<br />

hgstatus = HTDatabaseOpen("", "test.nsf", 0&, hgdatabase)<br />

124 <strong>LotusScript</strong> <strong>for</strong> <strong>Visual</strong> <strong>Basic</strong> <strong>Programmers</strong>

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!