MSI Factory 2.3

MSI.GetLastErrorRecord

MSI.GetLastErrorRecord

This is the first topic This is the last topic  

MSI.GetLastErrorRecord

This is the first topic This is the last topic  

OverviewExamples

number MSI.GetLastErrorRecord (

)

Example 1

hDatabase = MSI.GetActiveDatabase(_hInstall);

 

if (hDatabase ~= 0) then

   --strQuery = "SELECT * FROM `Feature`";

   -- THE FOLLOWING LINE PRODUCES AN ERROR. ABOVE IS CORRECT LINE.

   strQuery = "SELECT * FROM `Feature";

   hView = MSI.DatabaseOpenView(hDatabase, strQuery);

   if (hView ~= 0) then

 

       bExecuteResult = MSI.ViewExecute(hView, 0);

       if (bExecuteResult) then

           bContinue = true;

           strValues = "The Feature IDs are:\r\n\r\n";

 

           while (bContinue) do

               hRecord = MSI.ViewFetch(hView);

               if (hRecord ~= 0) then

                   strRecordString = MSI.RecordGetString(hRecord, 1);

                   strValues = strValues..strRecordString.."\r\n";

               else

                   bContinue = false;

                   MSI.CloseHandle(hRecord);

               end

           end

       end

 

       Dialog.Message("Feature IDs", strValues);

 

       MSI.ViewClose(hView);

       MSI.CloseHandle(hView);

 

   else

       hError = MSI.GetLastErrorRecord();

       strError = MSI.FormatRecord(_hInstall, hError);

       Dialog.Message("Error", "Error opening database view:\r\n"..strError);

   end

 

   MSI.CloseHandle(hDatabase);

end

Gets the IDs of all the features and shows them in a dialog message. The above script contains an intentional error where there is a missing ending quote in the query to illustrate the functionality of MSI.GetLastErrorRecord and MSI.FormatRecord.

See also: Related Actions


Learn More: Indigo Rose Software - MSI Factory - Buy Now - Contact Us