Directly connect SQL database in IE

Source: Internet
Author: User
Tags connect prepare xmlns
Data | database using ODC documentation

Using an ODC document makes it easy to connect to a SQL Server database table in IE Explorer, as in an ODC document such as:

<odc:connectionstring>provider=sqloledb.1;integrated Security=sspi; Persist Security Info=true;data Source=develop; Use Procedure for prepare=1; Auto translate=true; Packet size=4096; Workstation Id=develop; Use encryption for Data=false; Tag with column collation when Possible=false;initial catalog=k0712</odc:connectionstring>

<odc:CommandType>Table</odc:CommandType>

<odc:CommandText> "K0712". dbo "." Icinventory "</odc:CommandText> </odc:Connection> </odc:OfficeDataConnection></xml>< style><!--.    Odcdatasource {behavior:url (DATACONN.HTC); }--></style> 1pt; padding:2px; Background-color:threedface ' >            </td>   &LT;/TR >   <tr>     <td colspan= ' 2 ' style= ' height:100%; padding-bottom:4px; border-top:1px threedhighlight solid; ' >       <div id= ' pt ' style= ' height:100% ' class= ' Odcdatasource ' ></div>      </td>   </tr> </table> <script language= ' JavaScript ' > function init () {  var sname, sdescription;   var i, J;   try {    sname = unescape (location.href)     i = Sname.lastindexof (".")  &nbsp ;  if (i>=0) {sname = sname.substring (1, i);}     i = Sname.lastindexof ("/")     I F (i>=0) {sname = Sname.substring (i+1, sname.length);}     document.title = sname;     document.getElementById ("Tdname"). innertext = sname;     SdescriptIon = document.getElementById ("Docprops"). InnerHTML;     i = sdescription.indexof ("escription>")     if (i>=0) {j = Sdescription.indexof ("escription>", i + 11); }     if (i>=0 && J >= 0) {      j = sdescription.lastindexof ("< /", j);       if (j>=0) {          sdescription = Sdescription.substring (I+11, J);         if (sdescription!= "") {             document.getElementById ("Tddesc"). style.fontsize= "X-small";           document.getElementById ("Tddesc"). InnerHTML = Sdescription ;          }        }       }    }   catch (e) {   }  } </Script> </body>

In this way, you can easily display a datasheet on a Web page. J will know that the Web programming is actually an HTML text, using JavaScript to initialize the window layout, the bold part is a key part of the data connection, as follows:

<odc:connectionstring>provider=sqloledb.1;integrated Security=sspi; Persist Security Info=true;data Source=develop; Use Procedure for prepare=1; Auto translate=true; Packet size=4096; Workstation Id=develop; Use encryption for Data=false; Tag with column collation when Possible=false;initial catalog=k0712</odc:connectionstring>

<odc:CommandType>Table</odc:CommandType>

<odc:CommandText> "K0712". dbo "." Icinventory "</odc:CommandText>, odc:connectionstring is a database connection string, using the same format as ADO, do not have to say it J;odc:commandtype is the query type, Tables are table queries, SQL is a standard SQL statement query, Odc:commandtext is a query command text, and if it is a table type, just write the name of the form. such as master.dbo.sysobjects, if it is a SQL type, is a generic SQL statement, such as "Select T0.*from icstockbill t0 INNER JOIN icstockbillentry t1 on t0." Fstockbillid=t1. Fstockbillid ORDER by T0. Fstockbillid "



Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.