Back to getting vServer Office to execute in LiveCode Server Scripts on my IIS 5.1 web server
Mike Bonner
bonnmike at gmail.com
Fri Mar 9 08:15:20 CST 2012
I've been messing around so much I don't recall which version of the
livecode-server script I sent you. Looking at the one you posted I think I
sent the wrong one!
The order is wrong, you'll want to declare all the commands and functions
FIRST and then actually call them, otherwise they don't yet exist in memory
yet and this can cause issues. (at least so it seems to me.
The revised script is here. It doesn't do much, just tries to connect,
determines if the open failed, if it did, creates the db and structure
instead, then closes itself out.
--declare all handlers first
on DatabaseCreate
if the gClient of this stack is true then
put VConnection_Constructor( "localhost", "sa", "sa") into mConn
get VConnection_Open( mConn )
get ShowError()
put VDatabase_Constructor( mConn ) into mDatabase
else
put VDatabase_Constructor() into mDatabase
end if
get VDatabase_Open( mDatabase, "database1" )
get ShowError()
if VDatabase_ErrNumber( mDatabase ) is not "0" then
if VDatabase_ErrNumber( mDatabase ) is not "532480" then
get VDatabase_Create( mDatabase, "Database1", "kDscDatBlbInd" )
get showError()
CreateStructure
else
answer VDatabase_ErrString( mDatabase )
close the defaultStack
end if
end if
put VDatabase_Table( mDatabase, "Person" ) into mPerson
put VTable_Field( mPerson, "FirstName" ) into mFirstName
put VTable_Field( mPerson, "LastName" ) into mLastName
put VTable_Field( mPerson, "BirthDate" ) into mBirthDate
end DatabaseCreate
on DatabaseClose
get VDatabase_Close( mDatabase )
put VDatabase_Destructor( mDatabase ) into mDatabase
end DatabaseClose
on CreateStructure
put VDatabase_CreateTable(mDatabase, "Person") into pTable
get VTable_CreateVarcharField( pTable, "Name", 1022, "fIndexed" )
get VTable_CreateVarcharField( pTable, "LName", 1022, "fIndexed" )
get VTable_CreateDateField( pTable, "BirthDate", "fIndexed" )
end CreateStructure
function ShowError
put Valentina_ErrNumber() into errCode
put Valentina_ErrString() into errString
if errCode <> 0 then
show message box
put errString into message
end if
end ShowError
-- then go through the steps. init, then check for error (using the
showError function)
get valentina_initclient()
get showError()
-- call the databasecreate handler
databasecreate
-- a curiosity check of the current contents of mDatabase && mConn
-- could do a showError here also
put mDatabase && mConn
-- call the databaseclose handler and shutdown, then put the result of the
shutdown. (should be 0)
databaseClose
get valentina_shutdown
put it && the result
-- I think I mentioned, but I have vserver running in manual mode from the
--command line so I can watch the connection establish do its thing
-- and disconnect, live on the console.
?>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macserve.net/pipermail/valentina/attachments/20120309/96364300/attachment-0001.html>
More information about the Valentina
mailing list