Vijaya7890

How to create a new record in Binary Table in MSI

2 posts in this topic

Hi...

I am trying to add a record in Binary Table in an MSI file.

As Binary table has two fields/columns Name &Data , I am giving any string for Name(column 1) and streaming binary data from a VBS file into Data(column 2) .

I have tried with VB script and it is working fine,

Here is the VB Script file

Dim Installer
Dim Database
Dim View
Dim Record
Dim query
query="INSERT INTO `Binary` (`Name`, `Data`) VALUES ('NewBlob', ?)"
Set Installer = CreateObject("WindowsInstaller.Installer")

Set Record = Installer.CreateRecord(1)
Record.SetStream 1, "C:\Users\Admin\Desktop\coder\CA_Test.vbs"

Set Database = Installer.OpenDatabase("C:\Users\Admin\Desktop\7z920.msi", 1)

Set View = Database.OpenView(query)
View.Execute Record
Database.Commit

when i tried the same thing in autoit it is not working and it is not giving any syntax error.

AutoIt file: 

#include <File.au3>

$idVarInput_CAName="CA_Test"
$filepath="C:\Users\Admin\Desktop\coder\CA_Test.vbs"
$idVarInput_MSIPath="C:\Users\Admin\Desktop\7z920.msi"
$value="?"

Local $Query = "INSERT INTO Binary(Name,Data) VALUES('" & $idVarInput_CAName & "','" & $value & "')"

$oInstaller = ObjCreate("WindowsInstaller.Installer")
$oRec=$oInstaller.CreateRecord(1)
$r=$oRec.SetStream(1,$filepath)
$oDB = $oInstaller.OpenDataBase($idVarInput_MSIPath,1)
$oView = $oDB.OpenView($Query)
$oView.Execute($oRec)
$oDB.commit()

Please Help!

Thanks...

Share this post


Link to post
Share on other sites



3 hours ago, Vijaya7890 said:

Hi...

I am trying to add a record in Binary Table in an MSI file.

As Binary table has two fields/columns Name &Data , I am giving any string for Name(column 1) and streaming binary data from a VBS file into Data(column 2) .

I have tried with VB script and it is working fine,

Here is the VB Script file

Dim Installer
Dim Database
Dim View
Dim Record
Dim query
query="INSERT INTO `Binary` (`Name`, `Data`) VALUES ('NewBlob', ?)"
Set Installer = CreateObject("WindowsInstaller.Installer")

Set Record = Installer.CreateRecord(1)
Record.SetStream 1, "C:\Users\Admin\Desktop\coder\CA_Test.vbs"

Set Database = Installer.OpenDatabase("C:\Users\Admin\Desktop\7z920.msi", 1)

Set View = Database.OpenView(query)
View.Execute Record
Database.Commit

when i tried the same thing in autoit it is not working and it is not giving any syntax error.

AutoIt file: 

#include <File.au3>

$idVarInput_CAName="CA_Test"
$filepath="C:\Users\Admin\Desktop\coder\CA_Test.vbs"
$idVarInput_MSIPath="C:\Users\Admin\Desktop\7z920.msi"
$value="?"

Local $Query = "INSERT INTO Binary(Name,Data) VALUES('" & $idVarInput_CAName & "','" & $value & "')"

$oInstaller = ObjCreate("WindowsInstaller.Installer")
$oRec=$oInstaller.CreateRecord(1)
$r=$oRec.SetStream(1,$filepath)
$oDB = $oInstaller.OpenDataBase($idVarInput_MSIPath,1)
$oView = $oDB.OpenView($Query)
$oView.Execute($oRec)
$oDB.commit()

Please Help!

Thanks...

Change the query line as below

Local $Query = "INSERT INTO `Binary`(`Name`,`Data`) VALUES('" & $idVarInput_CAName & "'," & $value & ")"

In your code... is surrounded by single quotes as '?'.So your query isn't able to be parsed.

I removed only the single quote part...it is working..

1 person likes this

Share this post


Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!


Register a new account

Sign in

Already have an account? Sign in here.


Sign In Now

  • Similar Content

    • Valnurat
      By Valnurat
      I hope my title is good enough.
      I'm using the ADO UDF and I have question regarding editing SQL records with this UDF.
      The owner of the UDF suggested an idea, but maybe there is another trix.
    • Valnurat
      By Valnurat
      I have a SQL db. I would like to view the content in a control. Like a table. The control should have the option to show every 2nd line in another color. When you pick a "cell" it should pick the whole row. When you dobbelt click on the row another windows should popup with the content from the row.
      What view control can do that?
    • Valnurat
      By Valnurat
      How do I access a sql database for inserting and reading?
    • Valnurat
      By Valnurat
      I'm trying to get some info from dell.com page. I use a servicetag to find the computer. From the computerinfo I would like to get the "Shipping Date", but the date is on the next "cell".
      I have done this and I don't know if this is correct aproach, but I do get some info out.
      I just don't know how to "jump" to the next cell.
       
      #include <IE.au3> #include <MsgBoxConstants.au3> Local $oIE = _IECreate("http://www.dell.com/support/home/dk/da/dkbsdt1/product-support/servicetag/gnn5f12/configuration") Local $oTds = _IETagNameGetCollection($oIE, "td") Local $sTxt = "" For $oTd In $oTds $sTxt &= $oTd.innertext & @CRLF Next MsgBox($MB_SYSTEMMODAL, "Form Input Type", " Types :" & @CRLF & $sTxt) _IEQuit($oIE) I have seen something like this in VBscript
      Cell.NextSibling.NextSibling.innertext Is there someone who could help me.
       
    • srini
      By srini
      I am trying to automate the windows GUI application, in the main window of this application i have one gridview control in it, and when you click on the any row of the gridview separate windows will be opened based on the selection of the row. 
      we have our existing framework implemented using the core java,  i have used AutoITX4java.jar file to automate the above application. and controlCommandListView options used to click on grid view row item. nothing is working. 
      my question is AutoIT can be used/called directly from java file??? instead of using the AutoITX4java.jar file???
      AutoIT supports GridView automation??? like gridview count and gridivew row item click event automation ect...????
      Any help would be really appricate!!
      Thanks
      Srini
      srini20483@gmail.com