Advertisement
7_2009-2012 Databases/ JDBC #227213

ADO With JavaScript

I have not found any sample that shows database access with javaScript. Well, I created one. It is very simple since Javascript has the activeXObject that allow us to call an external object in the same way that vbscript uses CreateObject.

AI

Shrnutí AI: This codebase represents a historical implementation of the logic described in the metadata. Our preservation engine analyzes the structure to provide context for modern developers.

Zdrojový kód
original-source
<SCRIPT LANGUAGE=javascript>
	<!--
	var conn = new ActiveXObject("ADODB.Connection") ;
	var connectionstring = "Provider=sqloledb; Data Source=itdev; Initial Catalog=pubs; User ID=sa;Password=yourpassword"
	conn.Open(connectionstring)
	var rs = new ActiveXObject("ADODB.Recordset")
	rs.Open("SELECT gif, description, page, location FROM menu1", conn)
// Be aware that I am selecting from this table, but you need to pick your own table
	while(!rs.eof)
	{
		alert(rs(0));
		rs.movenext
	}
	 
	 rs.close
	conn.close 
	 
	//-->
	</SCRIPT>
Původní komentáře (3)
Obnoveno z Wayback Machine