1<script language= "JavaScript" >2 //To Create a database object3 varOBJdbConn =NewActiveXObject ("ADODB. Connection "); 4 //DSN String5 varstrDSN = "Driver={sql Server}; server=127.0.0.1; Uid=sa; Pwd=sa;database=coa "; 6 //Open Data Source7 Objdbconn.open (STRDSN); 8 //database queries that execute SQL9 varobjRS = Objdbconn.execute ("Select Menu_name from Basic_mainmenu"); Ten //get number of fields One varFdcount = objRS. Fields.count-1; A //Check if there is a record - if(!objRS. EOF) { -document.write ("<table border=1><tr>"); the //Display the field name of the database - for(vari=0; I <= Fdcount; i++) -document.write ("<td><b>" + objRS. Fields (i). Name + "</b></td>"); -document.write ("</tr>"); + //displaying database content - while(!objRS. EOF) { +document.write ("<tr>"); A //Show fields for each record at for(i=0; I <= fdcount; i++) -document.write ("<td valign= ' top ' >" + objRS. Fields (i). Value + "</td>"); -document.write ("</tr>"); -Objrs.movenext ();//move to the next record - } -document.write ("</table>"); in } - Else todocument.write ("No Records in database!<br>"); +objRS. Close ();//Close Record Collection -Objdbconn.close ();//Close Database Link the</script>