I am still a small rookie of IT industry, to participate in the work time is not long, but with their own a studious heart still have their own learning footsteps never stop, their programming is also a very fruitful ~ ~
It has always been assumed that JavaScript wants to interact with the database through Ajax to invoke server-side code (C # or Java), but only recently did it find that JavaScript can interact directly with the database ... Here is a simple data from the database to load to the interface of a small example (of JS operation data on the knowledge of everyone if there is any good advice we hope you can stay, we learn from each other, common progress) ~ ~
<! DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 transitional//en" > <HTML> <HEAD> <TITLE> New Document ;/title> <meta name= "generator" content= "EditPlus" > <meta name= "Author" content= "" > <meta NAME= "Keyw Ords "Content=" "> <meta name=" Description "content=" "> <script type=" text/javascript "> Function getData
() {//define SQL statement var sql = "Select Obj_id,obj_caption from Mw_sys.mwt_om_obj where rownum<5000"; New database Connection object and DataSet Access object var conndb = new ActiveXObject ("ADODB.
Connection "); Conndb.open ("Provider=MSDAORA.1; Password=app; User Id=mw_app;data Source=pms;
Persist security Info=true "); var rs = new ActiveXObject ("ADODB.
Recordset "); Rs.
ActiveConnection = conndb; Rs.
Open (SQL);
Traverse var S;
var rownum=0; var shtml= "<table cellpadding=0; cellspacing=0; Style= ' border:solid 1px gray; ' ><THEAD><TD style= ' border:solid 1px gray; Text-align:center; ' > Line number </td><td style= ' bOrder:solid 1px Gray; Text-align:center; ' > Job Text ID number </td><td style= ' border:solid 1px gray; '
> Professional number </td><tbody> "; while (!rs. EOF) {shtml+= "<tr><td style= ' border:solid 1px Gray; text-align:center; '
> ";
shtml+=rownum+1;
shtml+= "</td>"; for (i = 0;i<rs. Fields.count;++i) {shtml+= "<td style= ' border:solid 1px Gray; background-color:yellow; '
> "; Shtml+=rs. Fields (i). Value==null? " ": Rs.
Fields (i). value;
shtml+= "</td>";
} shtml+= "</tr>";
rownum++;
if (rownum==1000) break; Rs.
MoveNext ();
} shtml+= "</tbody></table>";
Rs.close ();
Conndb.close ();
document.getElementById ("Data"). innerhtml=shtml; } </script> </HEAD> <BODY> <input type= "button" value= "Table" onclick= "GetData ()"/> <d IV id= "Data" > </div> </BODY> </HTML>