如何链接组合框(下拉)和SQL(数据库值)?

时间:2019-07-02 13:56:30

标签: sql drop-down-menu vbscript combobox

 Dim myHWSETConn,myHWSETCommand,HWSETRS
 HWsetSelection = val(HWsetSelection)
 Const DB_CONNECT_STRING1 = "Provider=SQLOLEDB.1;Data Source=FWATRGSQLVCL2;Initial Catalog=Cal1;user id ='Caluser';password='caluser'"
  Set myHWSETConn = CreateObject("ADODB.Connection")
 Set myHWSETCommand = CreateObject("ADODB.Command" )
myHWSETConn.Open DB_CONNECT_STRING1
 Set myHWSETCommand.ActiveConnection = myHWSETConn
myHWSETCommand.CommandText = "SELECT [hw_fullname] FROM [Cal].[dbo].[Req_Simple] where Fwid= "&HWsetSelection&" "
Set HWSETRS = myHWSETCommand.Execute

我有这段代码可以从SQL中获取值,但是我尝试将其置于下拉菜单时遇到了困难

 call NewHwset.Items.Add(HWSETRS)

但是它说,键入不匹配的“ NewHwset.Items.Add”

我们非常感谢您的帮助, 谢谢。

0 个答案:

没有答案