/build/static/layout/Breadcrumb_cap_w.png

Update Binary

Hello,

I am trying to INSERT/UPDATE Binary table as follows,


Set installer = Wscript.CreateObject("WindowsInstaller.Installer")

Set database = installer.OpenDatabase(msiPath, msiOpenDatabaseModeTransact)

Set rec = installer.CreateRecord(1)
rec.SetStream 1, binPath

If bUpdate = True then
Set recView = database.OpenView("UPDATE `Binary` SET `Data` = ? WHERE `Name` = '" & binName & "'")
Else
Set recView = database.OpenView("INSERT INTO `Binary` (`Data`, `Name`) VALUES (?, '" & binName & "')")
End If

recView.Execute rec
database.Commit


Insert goes well, Update fails. It doesn't flash any error but then it doesn't even get updated. Am I doing something wrong???

0 Comments   [ + ] Show comments

Answers (5)

Posted by: pjgeutjens 14 years ago
Red Belt
0
Could it be that the Name column contains primary keys? Cause, a quote from MSDN's page on SQL queries and MSI:

UPDATE queries only work on nonprimary key columns.

could be your problem...

PJ
Posted by: milindsm 14 years ago
Blue Belt
0
If you look at the UPDATE query in my code snippet, you can see that I am only updating (SETting) `Data` field, `Name` is there only in WHERE clause.
Posted by: pjgeutjens 14 years ago
Red Belt
0
you are right, I overlooked that, my bad
Posted by: pjgeutjens 14 years ago
Red Belt
0
as a little test, have you tried using:

SET `Binary`.`Data` = ? WHERE `Binary`.`Name` = '" & binName & "'"

specifying the table name again?
Posted by: milindsm 14 years ago
Blue Belt
0
shall give it a try...!!!
Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
 
This website uses cookies. By continuing to use this site and/or clicking the "Accept" button you are providing consent Quest Software and its affiliates do NOT sell the Personal Data you provide to us either when you register on our websites or when you do business with us. For more information about our Privacy Policy and our data protection efforts, please visit GDPR-HQ