|
<%@language=javascript%>
<!--#include file=common.asp-->
<script language="javascript" runat="server">
var sLines;
function AddLine(sLine) {
if(''+sLines=='undefined') sLines = '';
sLines += '\n' + sLine;
}
function EndLine() {
Out('<html><head><sc'+'ript type="text/javascript">');
Out('\nfunction _onload() {');
Out(sLines);
Out('\n}');
Out('\n</sc'+'ript></head><body onload="_onload()"></body></html>');
PageCleanup();
Response.End();
}
</script>
<%
PageSetup();
Response.Buffer = true;
if(Request.QueryString("c").Count==1) {
var oConn;
var nID;
var rs;
switch(Request.QueryString("c").Item - 0) {
case 11: // drop table
if(Request.QueryString("table").Count==1) {
var sTable = Request.QueryString("table").Item;
var sql;
try {
if(IsJet(Object.Conn))
sql = 'drop table [' + sTable + ']';
else
sql = 'drop table "' + sTable + '"';
Object.Conn.Execute(sql);
}
catch(e) {
AddLine('alert("'+e.description+'");');
EndLine();
}
AddLine('alert("'+sTable+' was dropped.");');
AddLine('parent.location.reload(true);');
EndLine();
}
break;
case 12: // truncate table
if(Request.QueryString("table").Count==1) {
var sTable = Request.QueryString("table").Item;
var sql;
try {
if(IsJet(Object.Conn))
sql = 'delete from [' + sTable + ']';
else
sql = 'delete from "' + sTable + '"';
Object.Conn.Execute(sql);
}
catch(e) {
AddLine('alert("'+e.description+'");');
EndLine();
}
AddLine('alert("'+sTable+' was truncated.");');
AddLine('parent.location.reload(true);');
EndLine();
}
break;
case 13: // drop index
if(Request.QueryString("table").Count==1 && Request.QueryString("index").Count==1) {
var sTable = Request.QueryString("table").Item;
var sIndex = Request.QueryString("index").Item;
var oCat = Server.CreateObject("ADOX.Catalog");
oCat.ActiveConnection = Object.Conn;
try {
oCat.Tables(sTable).Indexes.Delete(sIndex);
oCat.Tables(sTable).Indexes.Refresh();
}
catch(e) {
AddLine('alert("'+e.description+'");');
EndLine();
}
AddLine('alert("'+sTable+'.'+sIndex+' was dropped.");');
AddLine('parent.location.reload(true);');
EndLine();
}
break;
case 14: // drop key
if(Request.QueryString("table").Count==1 && Request.QueryString("key").Count==1) {
var sTable = Request.QueryString("table").Item;
var sKey = Request.QueryString("key").Item;
var sql;
if(IsJet(Object.Conn)) {
sql = 'alter table [' + sTable + '] drop constraint [' + sKey + ']';
} else {
sql = 'alter table "' + sTable + '" drop constraint "' + sKey + '"';
}
try {
Object.Conn.Execute(sql);
}
catch(e) {
AddLine('alert("'+e.description+'");');
EndLine();
}
AddLine('alert("'+sTable+'.'+sKey+' was dropped.");');
AddLine('parent.location.reload(true);');
EndLine();
}
break;
case 15: // drop column
if(Request.QueryString("table").Count==1 && Request.QueryString("column").Count==1) {
var sql;
var err = '';
var sTable = Request.QueryString("table").Item;
var sColumn = Request.QueryString("column").Item;
if(IsJet(Object.Conn))
sql = 'alter table [' + sTable + '] drop column [' + sColumn + ']';
else
sql = 'alter table "' + sTable + '" drop column "' + sColumn + '"';
try {
Object.Conn.Execute(sql);
}
catch(e) {
AddLine('alert("'+e.description+'");');
EndLine();
}
AddLine('alert("'+sTable+'.'+sColumn+' was dropped.");');
AddLine('parent.location.reload(true);');
EndLine();
}
break;
case 16: // drop view
if(Request.QueryString("table").Count==1) {
var sTable = Request.QueryString("table").Item;
var sql;
try {
if(IsJet(Object.Conn))
sql = 'drop view [' + sTable + ']';
else
sql = 'drop view "' + sTable + '"';
Object.Conn.Execute(sql);
}
catch(e) {
AddLine('alert("'+e.description+'");');
EndLine();
}
AddLine('alert("'+sTable+' was dropped.");');
AddLine('parent.location.reload(true);');
EndLine();
}
break;
default:
Out('Unknown command ' + Request.QueryString("c").Item);
PageCleanup();
Response.End();
break;
}
}
%>
|
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.
This member has not yet provided a Biography. Assume it's interesting and varied, and probably something to do with programming.