Jump to content


This is a ready-only archive of the InstallSite Forum. You cannot post any new content here. / Dies ist ein Archiv des InstallSite Forums. Hier können keine neuen Beiträge veröffentlicht werden.
Photo

Update problem in CreateFolder table


Best Answer ur00361883 , 24 April 2015 - 12:51

Not like traditional databases, In MSI file we can't update a primary key with update query.In CreateFolder table, both Directory_ and Component_ are primary keys.

 
So, the approach I followed now is to read the complete row and delete it and create again with new value of Component_.
Go to the full post


4 replies to this topic

ur00361883

ur00361883
  • Full Members
  • 4 posts

Posted 22 April 2015 - 08:18

When I am trying to use the below query to update CreateFolder table, then I am getting runtime exception

 

value= "somecomponentname";

database.Execute("Update `CreateFolder` Set `CreateFolder`.`Component_` = '" + value + "'");

 

I tried the similar command in vbscript also along with c# but not working.

 

But the updation is working fine if I try in other tables like Registry,Property

 

Please help me on this.



deramor

deramor
  • Full Members
  • 187 posts

Posted 22 April 2015 - 16:27

I have no direct experience with this specific table but I did use database calls to modify a ListBox control at runtime.  It required to make edits the the ListBox table at runtime.  In developing this, I was only able to find code examples for a ComboBox.  I had to convert that code for my specific case.  I say this because I had one stumbling box when doing this.  I didn't get the number of properties per entry correct.  If you are using code that worked on one table but not another, check to make sure you are setting the correct number of properties for the table you want to edit.

 

The code I had wrong was:

 

hDatabase = MsiGetActiveDatabase(hMSI);

    sQuery = "SELECT * FROM ComboBox WHERE Property='COMBOBOXPROP'";
    // Open view into ComboBox Table
    nResult = MsiDatabaseOpenView(hDatabase, sQuery, hCBOView);
    
    // Allocate space to hold the properties of a combobox row...
    hRec = MsiCreateRecord(4);  <--------- this was set to 3 which caused me to have problems.

 

The number had to match the number of columns in the table

 

In your case, you need to set 2 properties.

In your code example, I only see one.



ur00361883

ur00361883
  • Full Members
  • 4 posts

Posted 24 April 2015 - 12:51   Best Answer

Not like traditional databases, In MSI file we can't update a primary key with update query.In CreateFolder table, both Directory_ and Component_ are primary keys.

 
So, the approach I followed now is to read the complete row and delete it and create again with new value of Component_.


ur00361883

ur00361883
  • Full Members
  • 4 posts

Posted 24 April 2015 - 12:53

 

Not like traditional databases, In MSI file we can't update a primary key with update query.In CreateFolder table, both Directory_ and Component_ are primary keys.

 
So, the approach I followed now is to read the complete row and delete it and create again with new value of Component_.

 



ur00361883

ur00361883
  • Full Members
  • 4 posts

Posted 24 April 2015 - 12:53

 

Not like traditional databases, In MSI file we can't update a primary key with update query.In CreateFolder table, both Directory_ and Component_ are primary keys.

 
So, the approach I followed now is to read the complete row and delete it and create again with new value of Component_.