用activex创选一个data控件,可以绑定到多数控件请参考 
Binding HTML Elements to Data--------------------------------------------------------------------------------To display the data provided by a data source object (DSO), the author binds elements on an HTML page to the DSO. Using the About Data Binding Architecture or the corresponding data binding properties makes it easy. This section shows how to bind an element to data, the elements that support data binding, and the capabilities of those elements. Capabilities include support for updating the data to which an element is bound and the format in which the data is displayed HTML or plain text.Bindable HTML elements fall into two categories single-valued and tabular consumers. Single-valued consumers bind to a single field of the current record provided by a DSO. Tabular consumers bind to an entire data set and use their contained elements as a template to repeat the data. In Microsoft® Internet Explorer 4.0, the table element is an example of a tabular data consumer, and the procedure for binding it to data is described in Binding HTML Elements to Data.Binding a Single-Valued Element to Data
Binding a TABLE to Data
Elements That Support Data Binding
Binding a Single-Valued Element to Data
The procedure for binding a single-valued element to data is the same regardless of the element. Elements can be bound to data at design time using the dataSrc and dataFld attributes, or DHTML Object Model Support for Data Binding using the dataSrc and dataFld properties exposed by the corresponding objects in the Dynamic HTML (DHTML) Object Model.Binding a Single-Valued Element to Data at Design Time
To specify a complete binding to a field in a data set, data-consuming elements use the dataSrc and dataFld attributes. Given a text box, for example, a page author can bind that element to data as follows:<INPUT TYPE=TEXTBOX DATASRC="#dsoComposers" DATAFLD="compsr_last">
The dataSrc attribute in this example specifies the ID, prefixed by a hash  (#), of a DSO embedded on the page. The hash  is required. The dataFld attribute identifies the field in the data provided by the DSO to which the text box should be bound.Click the Show Me button to see a working example.Show Me
Binding a TABLE to Data
Because the table element is a tabular data consumer, it relies on the elements that it contains to bind to the individual fields in the data set provided by the DSO. The contained elements serve as a template, and they are repeated once for each record in the data set. The table specifies the dataSrc attribute. The contained elements specify the dataFld attribute and inherit the dataSrc from the table.When binding a table to data, it is not possible to databind to a tr if it is contained by a tFoot or tHead.Here's a simple example:<TABLE DATASRC="#dsoComposer">
<TR>
  <TD><SPAN DATAFLD="compsr_first"></SPAN></TD>
</TR>
</TABLE>
Click the Show Me button to see a working example.Show Me
If a databound table element includes a tBody element, this is recognized as a part of the template for databinding and is repeated for each row in the dataset, in a manner similar to the tr element. Consider the following databound table.<TABLE DATASRC="#dsoComposer">
<TBODY>
<TR>
  <TD><SPAN DATAFLD="compsr_first"></SPAN></TD>
</TR>
</TBODY>
</TABLE>
In this example, the table that renders in the browser contains one tBody element for each row of data in the data source.Note  When multiple tBody elements occur in the document, the tBodies collection can be used in script to reference these objects.
As with single-valued consumers, a tabular data consumer can be bound to data at run time using the DHTML Object Model. The procedure for accomplishing this is described below.Elements That Support Data Binding
The previous sections use a TEXTBOX, a span element, and a table element to illustrate how to bind single-valued and tabular consumers to the data provided by a DSO. Many other HTML elements can be bound to data. Some of these elements support updating the data to which they are bound. Changes can be persisted to the back-end data set if the DSO supports update. Other elements support About Data Binding Architecture in addition to the plain text default using the dataFormatAs attribute.The following table lists the single-valued HTML elements that support data binding. The table also includes additional columns that indicate: If the element supports update. 
If the element can render its data as HTML. 
The property to which the data is applied. 
Use the drop-down list to filter the elements appropriately. Bindable ElementsBindable elements that support updateBindable Read-Only ElementsBindable elements that support rendering in HTML Element Updatable Renders HTML Bound Property 
A False False href 
APPLET True False property value via PARAM 
BUTTON False True innerText, innerHTML 
DIV False True innerText, innerHTML 
FRAME False False src 
IFRAME False False src 
IMG False False src 
INPUT TYPE=BUTTON False True innerText, innerHTML 
INPUT TYPE=CHECKBOX True False checked 
INPUT TYPE=HIDDEN True False value 
INPUT TYPE=PASSWORD True False value 
INPUT TYPE=RADIO True False checked 
INPUT TYPE=TEXT True False value 
LABEL False True innerText, innerHTML 
LEGEND False True innerText, innerHTML 
MARQUEE False True innerText, innerHTML 
SELECT True False obj.options(obj.selectedIndex).text 
SPAN False True innerText, innerHTML 
TEXTAREA True False value 
Read-only Elements
Bindable HTML elements that supply read-only functionality include a, button, div, img, frame, iframe, label, marquee, and span. Additionally, the button, div, label, marquee, and span elements support the usage of the dataFormatAs attribute or property to render the data to which they are bound as plain text (default) or as HTML. The data displayed by the element is automatically updated as the record pointer maintained by the DSO moves, or as the underlying data to which the element is bound changes. The following are descriptions of these read-only elements.A

解决方案 »

  1.   

    An anchor element applies the data supplied by a DSO to the href attribute; thus, the supplied data should represent a URL. The following is an example of a bound anchor.<A DATASRC="#dsoLinks" DATAFLD="link_href"><SPAN DATASRC="#dsoLinks
    DATAFLD="link_friendly"></SPAN></A>
    Click the Show Me button to see a working example.Show Me
    BUTTON
    A button element renders the data supplied by a DSO on its face. The following is an example of a bound button.<BUTTON DATASRC="#dsoLinks" DATAFLD="link_friendly"></BUTTON>
    Click the Show Me button to see a working example.Show Me
    DIV
    A div element is useful for displaying a block of text. The following is an example of a bound div.<DIV DATASRC="#dsoComposer" DATAFLD="compsr_biography"></DIV>
    Click the Show Me button to see a working example.Show Me
    FRAME
    A frame element applies the data supplied by a DSO to its src attribute; thus, the bound value should represent a URL. So that the binding occurs successfully, the DSO supplying data to a bound frame should be present in the head section of the HTML file containing the frameSet element. The following is an example of a bound frame.<HTML>
    <HEAD>
    <!-- Add DSO reference here -->
    </HEAD>
    <FRAMESET>
        <FRAME DATASRC="#dsoFAQ" DATAFLD="frame_question" ...>
        <FRAME DATASRC="#dsoFAQ" DATAFLD="frame_answer" ...>
    </FRAMESET>
    </HTML>
    The code behind the following Show Me button implements a frame-based FAQ. The first frame displays the question, the second frame displays the answer, and the third frame contains navigation buttons. The first and second frames are bound to a two-column table. The first column in the table contains relative paths to pages containing questions. The second column contains relative paths to pages containing the answers. Since the DSO is embedded in the head of the outer page containing the frameSet, the code behind the navigation buttons drills out of the page in which it resides using the top object and references the DSO by its ID. The top object returns an object reference to the outermost containing window.Click the Show Me button to see a working example.Show Me
    IFRAME
    An iframe element applies the data supplied by a DSO to its src attribute; thus, the data should represent a URL. In contrast to the frame case, the DSO can be declared anywhere on the page. The following is an example of a bound iframe.<IFRAME DATASRC="#DSC1" DATAFLD="iframe_url">
    Click the Show Me button to see a working example.Show Me
    IMG
    An img element applies the data supplied by a DSO to locate, load, and display the image typically pointed to by its src attribute. Supplying raw image data through the bound column is not supported. The following is an example of a bound img tag.<IMG DATASRC="#tdcImages" DATAFLD="image"></SPAN>
    Click the Show Me button to see a working example.Show Me
    LABEL
    Use a label element to describe another bound element on the page. A label applies the data supplied by a DSO to its caption. The following is an example of a bound label.<LABEL FOR=somecontrolid DATASRC="#DSC1" DATAFLD="label_col"></LABEL>
    Since a label is associated with other elements indicated by its htmlFor attribute, using a bound label within a repeated table can yield unexpected results. If the htmlFor attribute references another element within the repeated table, the label tag will not be associated with the elements, since there will be multiple elements with the same ID/NAME as a result of the repetition.LEGEND
    The legend element adds a caption to the box drawn by the fieldSet element. When databinding is used with the legend element, the data supplied by the DSO appears in the fieldSet caption. The following is an example of a bound legend element.<FIELDSET>
    <LEGEND DATASRC=#tdcElements DATAFLD="element"></LEGEND>
    <INPUT CONTENTEDITABLE="FALSE" TYPE="TEXT" DATASRC=#tdcElements DATAFLD="boundto">
    </FIELDSET>
    Click the Show Me button to see a working example.Show Me
    MARQUEE
    A marquee element uses its bound data to replace the text that appears between its opening and closing tags. The following is an example of a bound marquee.<MARQUEE DATASRC="#dsoComposer" DATAFLD="bio" DATAFORMATAS="HTML"></MARQUEE>
    Click the Show Me button to see a working example.Show Me
    SPAN
    Like a div, a span is a read-only data consumer. Use a span to display inline text or limited HTML text. If the span is used to display HTML text, that text should not include any HTML block elements. When the current record or the underlying value in the bound column provided by the DSO changes, the span reflects the change. The following is an example of a bound span.<SPAN DATASRC="#dsoComposer" DATAFLD="compsr_last"></SPAN>
    Click the Show Me button to see a working example.Show Me
    Elements That Support Update
    The input (with the exception of the button type), select, textArea, object, and applet elements support updating the data to which they are bound, if the underlying DSO supports update functionality. The following are descriptions of these individual elements.INPUT
    The input element represents a set of HTML intrinsic controls. Each of the types that support data binding (input type=checkbox, input type=hidden, input type=password, input type=radio, and input type=text) is detailed in the following sections. Security Alert  Using the input element incorrectly can compromise the security of your application. In general, don't assume that user input is valid or benign. Avoid rendering unverified user input as HTML, or transferring that input from an untrusted context to a trusted context within your application. You should review Security Considerations: Dynamic HTML before continuing. 
    CHECKBOX
    Although check boxes allow a value attribute that is used when submitting an HTML form on a page, Internet Explorer 4.0 MSHTML uses check boxes as simple Boolean selections. Check boxes generate the Boolean values true or false depending on whether they are checked or not. The binding agent coerces the values to and from the underlying data set. The following coercions are supported, based on the type of the bound column.The following table describes the values that a bound check box expects a DSO to supply for various data types.Data type Expected True value Expected False value 
    String "True" | "1" | <nonempty string>  "False" | "0" | <zerolength string>  
    Integer nonzero 0 
    Float nonzero 0 
    Date invalid invalid 
    Currency nonzero 0 The following is an example of a bound check box.
      

  2.   

    ms-help://MS.VSCC.2003/MS.MSDNQTR.2003FEB.2052/databind/workshop/author/databind/dataconsumer.htm
    太长了,你可以看这个msdn中...
      

  3.   

    rs.Open()的写法有误,正确写法应该是如下例:rs.Open(sql,conn,1,1)
      

  4.   

    var xDOM= new ActiveXObject("MSXML.DOMDocument");
       var rsXML= new ActiveXObject("ADODB.Recordset");
       var sSQL, sConn
       sSQL = "select * from bmc_cet where xh="+document.all("checkbox"[i].value+"";
       sConn= "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=d:\\bs.mdb";
       rsXML.Open(sSQL, sConn)
    连接access型数据库
      

  5.   

    可我需要连接的是sql数据库啊
      

  6.   

    <%@ language=JScript %> 
    <HTML> 
    <BODY> 
    <TITLE>ASP+JSCRIPT</TITLE> 
    <SCRIPT LANGUAGE="JSCRIPT" RUNAT="Server"> 
    Response.write('<TABLE border="1" cellspacing="0" cellpadding="0">'); 
    var sSQL = 'SELECT * FROM authors'; 
    var oConn= new ActiveXObject("ADODB.Connection"); 
    oConn.Open('Provider=SQLOLEDB;Server=(local);Database=pubs;UID=sa;PWD=;'); 
    var rs = oConn.Execute(sSQL);   
    var i; 
    Response.write('<tr>'); 
    for (i = 0; i < rs.Fields.Count - 1; i++) 

    Response.write('<td>' + rs(i).Name + '</td>'); 

    Response.write('</tr>'); while (!rs.EOF) 

      Response.write('<tr>');   
      for (i = 0; i < rs.Fields.Count - 1; i++) 
      { 
        Response.write('<td>' + rs(i).Value + '</td>'); 
      } 
      Response.write('</tr>'); 
      rs.MoveNext(); 

    rs.Close(); 
    oConn.Close(); 
    rs=null; 
    oConn = null; 
    Response.write('</TABLE>'); 
    </SCRIPT> 
    </BODY> 
    </HTML>