Microsoft KB Archive/233188

From BetaArchive Wiki
Knowledge Base


How to bind the Datagrid Control to the ADO Data Control on a Web page

Article ID: 233188

Article Last Modified on 5/11/2006



APPLIES TO

  • Microsoft Internet Explorer 4.0 128-Bit Edition
  • Microsoft Internet Explorer 4.01 Service Pack 2
  • Microsoft Internet Explorer 4.01 Service Pack 1
  • Microsoft Internet Explorer 4.01 Service Pack 2



This article was previously published under Q233188

SUMMARY

To bind a Microsoft Datagrid Control 6.0 to a Microsoft ADO Data Control 6.0 with Microsoft Visual InterDev, it is not enough to just set the Datagrid DataSource property to point to the ADO Data Control in the design view as if using them inside a Visual Basic application. With the assumption that you are familiarize working with these ActiveX controls and Visual InterDev, this article describes the steps to make these two controls bind together.

MORE INFORMATION

In order to make the Datagrid Control bind to the ADO Data Control, the following steps are needed.

  1. Create new a html page in Visual InterDev
  2. Insert the ADO Data Control and Datagrid Control in the page
  3. Set the properties of the ADO Data Control to connect to a database
  4. Resize Datagrid Control, so it will appear big enough to display data on the page
  5. To bind the Datagrid Control with the ADO Data Control when the page loads, you would write the following codes in the window_onload event. Otherwise you would write these codes in other events.

    <SCRIPT LANGUAGE=vbscript>
    <!--
        Sub window_onload()
              ' Datagrid1 is the id of the Datagrid control
              ' Adodc1 is the id of the ADO Data Control
          Set Datagrid1.DataSource = Adodc1.Recordset
        End sub
    //-->
    </SCRIPT>
                            
  6. Save this html page and view it under Microsoft Internet Explorer. You will see the data is displayed on the Datagrid control.


Note: These controls are licensed controls, you might need to add the license for these controls to view this page on machines that do not have the required license. Please see

159923 How to use licensed ActiveX controls in Internet Explorer


REFERENCES

For more information about developing Web-based solutions for Microsoft Internet Explorer, visit the following Microsoft Web sites:


To learn more about Microsoft Visual InterDev, please go to http://msdn.microsoft.com/vinterdev/
To learn more about the ADO Data Control and Datagrid Control, please reference to your Visual Basic Menu or searchMSDN Online


Additional query words: ADODC DATAGRID DataSource

Keywords: kbhowto kbsbnworkshop KB233188