Click here to Skip to main content
15,885,366 members
Articles / Programming Languages / ASP

Online DB Administration

Rate me:
Please Sign up or sign in to vote.
3.88/5 (16 votes)
17 Mar 2003 236.3K   2.5K   58  
Online administration of your database. Create or modify tables, keys, and indexes. Edit or insert data.
<!--#include file=config.asp-->
<!--#include file=adojavas.inc-->

<%
//---- AllowNullsEnum Values ----
var adIndexNullsAllow		= 0x00000000;
var adIndexNullsDisallow	= 0x00000001;
var adIndexNullsIgnore		= 0x00000002;
var adIndexNullsIgnoreAny	= 0x00000004

//---- KeyTypeEnum Values ----
var adKeyPrimary			= 0x00000001;
var adKeyForeign			= 0x00000002;
var adKeyUnique				= 0x00000003;

//---- RuleEnum Values ----
var adRICascade				= 0x00000001;
var adRINone				= 0x00000000;
var adRISetDefault			= 0x00000003;
var adRISetNull				= 0x00000002;
%>

<script language=javascript runat=server>
function Out(s) {
	Response.Write(s);
}

function DebugOut(s) {
	Response.Write("<div style=\"background-color:#FFC0C0; border: 1px solid black; padding: 4px; margin:2px\">" + s + "</div>");
}

function ErrorOut(s) {
	Response.Write("<div class=\"bgriderror\">" + s + "</div>");
}

function PageSetup() {
	Response.Buffer = true;
	Response.Expires = 0;
	CheckSecurity();

	Object.Conn = Server.CreateObject("ADODB.Connection");
	Object.Conn.Open(Config("connstr"));
	Object.Conn.CursorLocation = adUseClient;
	
	jsSetLocale(Config('locale'));
}

function PageCleanup() {
	Object.Conn.Close();
	Object.Conn = null;
}

function NewPageHeader() {
	Out('<html>\n');
	Out('<head>\n');
	Out('<title>' + Config('title') + '</title>\n');
	Out('<meta http-equiv="expires" content="-1">\n');
	Out('<meta http-equiv="pragma" content="no-cache">\n');
	Out('<meta http-equiv="cache-control" content="no-cache">\n');
	Out('<link rel="stylesheet" type="text/css" href="style.css">\n');
	Out('<scr'+'ipt type="text/javascript" src="netdb.js"></scri'+'pt>\n');
	Out('</head>\n');
	Out('<body onload="body_onload()">\n');
	Out('<form method="post" action="' + Request.ServerVariables("SCRIPT_NAME").Item + '?'+Request.QueryString+'">\n');
	_TableMenu();
}

function NewPageFooter() {
	Out('<hr>\n');
	Out('<em>Copyright &copy; 2002 Bj�rnar Henden</em>\n');
	Out('</form>\n');
	Out('<iframe name="cmdfrm" style="display:none"/>\n');
	Out('</body>\n');
	Out('</html>\n');
}

function EndPage(sRedirect) {
	NewPageFooter();
	PageCleanup();
	if(sRedirect!="") Response.Redirect(sRedirect);
	Response.End();
}

function GetFormValue(varname,vardef) {
	if(Request.Form(varname).Count==1)
		return Request.Form(varname).Item;
	else
		return vardef;
}

function PutFormValue(varname,varvalue) {
	Out("<input type=\"hidden\" name=\"" + varname + "\" value=\"" + varvalue + "\"/>\n");
}

function IsJet(oConn) {
	try {
		return (""+oConn.Properties("DBMS Name")).indexOf("Jet")>=0;
	}
	catch(e) {
		return oConn.ConnectionString.indexOf("Jet")>=0;
	}
}

function _TableMenu() {
	Out('<table width="100%"><tr>');
	Out('<td align="left"><b>' + Config("Title") + '</b> - '+Config('database')+'</td>');
	Out('<td align="right">');
		Out('<a href="." target="_top">Home</a>\n');
		Out('| <a href=".." target="_top">Parent</a>\n');
		Out('| <a href="http://www.bhenden.org/" target="_top">www.bhenden.org</a>\n');
	Out('</td>');
	Out('</tr></table><hr>');
}
</script>

<script language="vbscript" runat="server">
sub jsSetLocale(loc)
	SetLocale(loc)
end sub
</script>

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article has no explicit license attached to it but may contain usage terms in the article text or the download files themselves. If in doubt please contact the author via the discussion board below.

A list of licenses authors might use can be found here


Written By
Web Developer
Norway Norway
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.

Comments and Discussions