/bundles/itninjaweb/img/Breadcrumb_cap_w.png
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   [ - ] Hide Comments

Comments

Please log in to comment

Rating comments in this legacy AppDeploy message board thread won't reorder them,
so that the conversation will remain readable.
Answer this question or Comment on this question for clarity

Answers

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
Answered 02/25/2010 by: pjgeutjens
Red Belt

Please log in to comment
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.
Answered 02/25/2010 by: milindsm
Blue Belt

Please log in to comment
0
you are right, I overlooked that, my bad
Answered 02/25/2010 by: pjgeutjens
Red Belt

Please log in to comment
0
as a little test, have you tried using:

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

specifying the table name again?
Answered 02/25/2010 by: pjgeutjens
Red Belt

Please log in to comment
0
shall give it a try...!!!
Answered 02/25/2010 by: milindsm
Blue Belt

Please log in to comment