This website uses cookies. By clicking Accept, you consent to the use of cookies. Click Here to learn more about how we use cookies.
Turn on suggestions
Auto-suggest helps you quickly narrow down your search results by suggesting possible matches as you type.
- Revenera Community
- :
- InstallShield
- :
- InstallShield Forum
- :
- VBScript SQL Combo box
Subscribe
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Subscribe
- Mute
- Printer Friendly Page
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Oct 29, 2007
12:41 PM
VBScript SQL Combo box
Trying to run a sql select statement to retrieve a list and load it into a combo box. I have tried applying the same concept as the VBScript ComboBox that i used for IIS site listings. but my script either hangs or errors
Here is what I have.
Here is what I have.
Option Explicit
On Error Resume Next
Dim TESTSTRING
Dim objView
Dim objDB
Dim objInstaller
Dim objBindingList
Dim objRecord
Dim objW3SVC, objIisWebSite
Dim lngOrder
Dim o_SQL, o_Reader, o_Connection
Set objDB = Session.Database
Set objInstaller = Session.Installer
Set objView = objDB.OpenView("select * from ComboBox")
' enumerate webservers on localhost and populate ComboBox table
Set o_Connection = CreateObject("ADODB.Connection")
Set o_SQL = CreateObject("ADODB.Command")
Set o_Reader = CreateObject("ADODB.RecordSet")
o_Connection.Provider = "SQLOLEDB.1"
o_Connection.Properties("Data Source").Value = Session.Property("IS_SQLSERVER_SERVER")
o_Connection.Properties("Initial Catalog").Value = "MYDATABASE"
If GetProp("IS_SQLSERVER_USERNAME") < " " Then
o_Connection.Properties("Integrated Security").Value = "SSPI"
Else
o_Connection.Properties("Persist Security Info").Value = False
o_Connection.Properties("User ID").Value = GetProp("IS_SQLSERVER_USERNAME")
o_Connection.Properties("Password").Value = GetProp("IS_SQLSERVER_PASSWORD")
End If
o_Connection.Open
Set o_SQL.ActiveConnection = o_Connection
o_SQL.CommandText = "SELECT Field1, Field2 FROM MYDATABASE.dbo.MYTABLE"
Set o_Reader = o_SQL.Execute
o_Reader.MoveFirst
lngOrder = 1
Do Until o_Reader.EOF
add site name to ComboBox table (which is used by our dialog ComboBox)
Set objRecord = objInstaller.CreateRecord(4)
objRecord.StringData(1) = "MYLIST" ' property name
objRecord.IntegerData(2) = lngOrder ' order
objRecord.StringData(3) = o_Reader.Fields("field1").Value' value
objRecord.StringData(4) = o_Reader.Fields("field2").Value ' text
' now add the record to the table
Call objView.Execute(objRecord)
Call objView.Modify(7, objRecord) ' (7 = msiViewModifyInsertTemporary)
lngOrder = lngOrder + 1
o_Reader.MoveNext
Loop
Call objView.Close
' Supplemental Functions and Subs for Working with InstallShield
Sub SetProp(s_PropertyName, s_PropertyValue)
Session.Property(s_PropertyName) = s_PropertyValue
End Sub
Function GetProp(s_PropertyName)
GetProp = Session.Property(s_PropertyName)
End Function
(1) Reply
- Mark as New
- Subscribe
- Mute
- Permalink
- Report Inappropriate Content
Oct 30, 2007
04:57 PM
I have figured out now that the code seems to be correct in appearance, althought I have traced down that it does not error it simply gets stuck in the loop never hitting EOF causing the processor to climb to 100% and just keeps running unless reset manually.
any suggestions?
any suggestions?
![](/skins/images/089A6DFE1F4989CB8CCC689A38D62C96/responsive_peak/images/icon_anonymous_message.png)