PRB: Listbox DTC Does Not Show Changes When Bound Recordset Changes
ID: Q229701
|
The information in this article applies to:
-
Microsoft Visual InterDev, version 6.0
-
Active Server Pages
SYMPTOMS
A Listbox Design-Time Control (DTC) does not reflect the changes in a Recordset DTC when the Recordset DTC changes; that is, if the result set of a Recordset DTC changes, the Listbox DTC does not show this changed result set.
RESOLUTION
To overcome this problem, you need to clear the Listbox DTC of its entries so the next change in the Recordset DTC reflects on the Listbox DTC.
STATUS
This behavior is by design.
MORE INFORMATION
Steps to Reproduce Behavior
- Create a new project in Visual InterDev 6.0.
- Add an Active Server Page (ASP) page (Asp1.asp) to the project.
- Create a Data Connection (Connection1) to the NorthWind Database, Nwind.mdb.
- Add a Recordset DTC (Recordset1) to the page.
- Set the properties of the Recordset to use Connection1, and use the Employees table.
- Add a Listbox DTC (Listbox1) to the page.
- Right-click Listbox1 and select Properties.
- On the General tab, set the Recordset property to Recordset1 and the Field property to the EmployeeID field.
- Click the Lookup tab.
- Select the Recordset option.
- Set the Rowsource to Recordset1.
- Set the ListField and the Bound Column each to the EmployeeID field.
- Click OK.
- Add a Button DTC (Button1) to Asp1.asp
- When the button is clicked the recordset is changed by using the recordset.setSQLText method. Add the following code to Asp1.asp to run for the onclick event of Button1.
<%
Sub Button1_onclick()
strSQL = "SELECT * FROM employees WHERE EmployeeID > 4"
If Recordset1.isOpen() Then Recordset1.close
Recordset1.setSQLText strSQL
Recordset1.open
End Sub
%>
- Save the Asp1.asp file.
- Right-click Asp1.asp and select View in Browser.
- Click Button1.
- This re-queries Recordset1 so it returns only records where the value of the EmployeeID field is greater than 4, but Listbox1 does not reflect the changes.
Use the following code to work around this behavior:
<%
Sub Button1_onclick()
strSQL = "SELECT * FROM employees WHERE EmployeeID > 4"
If Recordset1.isOpen() Then Recordset1.close
Listbox1.clear
Recordset1.setSQLText strSQL
Recordset1.open
End Sub
%>
Using the Listbox1.clear method resets the contents of Listbox1 and forces it to update the contents when you open Recordset1.
REFERENCES
For more information on Visual InterDev and Design-Time Controls, please refer to http://msdn.microsoft.com/vinterdev.
Additional query words:
kbvisID600 kbASPGrp
Keywords : kbCtrl kbVisID600 kbGrpASP kbDSupport
Version : WINDOWS:6.0; winnt:
Platform : WINDOWS winnt
Issue type : kbprb