visual basic中的绑定集合对象6

时间:2013-11-07 02:56:31

标签: vb6

我想使用DHTML类型的visual basic 6项目来创建一个可以与数据库交互的html页面。 msdn有一个例子: http://msdn.microsoft.com/en-us/library/aa229040(v=vs.60).aspx 在这个例子中使用了一个BindingCollection对象,而在我的vb6中没有定义这样的对象! 代码是:

Dim colBind As BindingCollection

Private Sub DHTMLPage_Load()
' Create a BindingCollection object, then set its
' DataSource property to your data environment and its
' DataMember property to the Customers command object.
Set colBind = New BindingCollection
With colBind
Set .DataSource = MyDataEnvironment
.DataMember = "Customers"

' Bind the Value property of elements on the HTML page
' to fields in the Customers recordset.
.Add CustomerID, "Value", "CustomerID"
.Add CompanyName, "Value", "CompanyName"
.Add Address, "Value", "Address"
.Add City, "Value", "City"
.Add Region, "Value", "Region"
.Add PostalCode, "Value", "PostalCode"
.Add Country, "Value", "Country"
End With

End Sub

1 个答案:

答案 0 :(得分:0)

您需要在项目中添加对BindingCollection对象的类型库的引用。 要添加引用,请在“项目”菜单上选择“引用”,然后选择“Microsoft数据” “引用”对话框中的“绑定集合”。