|
<%@language=javascript%>
<!--#include file=common.asp-->
<%
function Content(Conn) {
var oCat = Server.CreateObject("ADOX.Catalog");
oCat.ActiveConnection = Conn;
if(Request.Form("createkey").Count==1) {
try {
var oIndex = Server.CreateObject("ADOX.Index");
oIndex.Name = GetFormValue("name",null);
oIndex.Clustered = GetFormValue("clustered",false) ? true : false;
oIndex.IndexNulls = GetFormValue("indexnulls",false) ? true : false;
oIndex.PrimaryKey = GetFormValue("primarykey",false) ? true : false;
oIndex.Unique = GetFormValue("unique",false) ? true : false;
var nCol = 0;
do {
var sTmp = GetFormValue("column"+nCol,"");
if(sTmp=="") break;
oIndex.Columns.Append(sTmp);
nCol++;
} while(true);
oCat.Tables(Request.QueryString("table").Item).Indexes.Append(oIndex);
oIndex = null;
EndPage("indexes.asp?table="+Request.QueryString("table").Item);
}
catch(e) {
Out('\n<s'+'cript type="text/javascript">\nSetErrorMessage("' + e.description + '");\n</scr'+'ipt>\n');
}
}
Out('<table class="list" cellspacing="0" cellpadding="0">');
var sName = GetFormValue("name","");
Out('<tr><th colspan="2">' + Request.QueryString('table').Item + '</th></tr>');
Out("<tr class=gridrow><td>Name:</td>");
Out("<td><input type=edit value=\"" + sName + "\" name=\"name\"></td></tr>");
Out("<tr><td>Clustered:</td><td><input type=checkbox "+(GetFormValue("clustered",false)?"checked ":"")+"name=clustered /></td></tr>");
Out("<tr><td>Nulls:</td><td><input type=checkbox "+(GetFormValue("indexnulls",false)?"checked ":"")+"name=indexnulls /></td></tr>");
Out("<tr><td>Primary Key:</td><td><input type=checkbox "+(GetFormValue("primarykey",false)?"checked ":"")+"name=primarykey /></td></tr>");
Out("<tr><td>Unique:</td><td><input type=checkbox "+(GetFormValue("unique",false)?"checked ":"")+"name=unique /></td></tr>");
var bTitle = false;
var nColumn = 0;
do {
Out("<tr><td>");
if(!bTitle) {
bTitle = true;
Out("Columns:");
} else {
Out(" ");
}
Out("</td><td>");
sTmp = GetFormValue("column"+nColumn,"");
Out("<select name=\"column"+nColumn+"\" onchange=\"this.form.submit()\">");
Out("<option value=\"\"><select column></option>");
for(var e=new Enumerator(oCat.Tables(Request.QueryString("table").Item).Columns);!e.atEnd();e.moveNext()) {
Out("<option ");
if(e.item().Name==sTmp) Out("selected ");
Out("value=\"" + e.item().Name + "\">" + e.item().Name + "</option>");
}
Out("</select>");
Out("</td></tr>");
nColumn++;
if(sTmp=="") break;
} while(true);
Out("<tr><td colspan=2>");
Out("<input type=submit name=\"createkey\" value=\"Create Index\"/>");
Out("</td></tr>");
Out("</table>");
oCat = null;
Out('<br>');
Out('<table class="list" cellspacing="0" cellpadding="0">\n');
Out('<tr>\n');
Out('<td> <a href="columns.asp?table='+Request.QueryString('table').Item+'">Back</a> </td>\n');
Out('</table>\n');
}
PageSetup();
NewPageHeader();
Content(Object.Conn);
NewPageFooter();
PageCleanup();
%>
|
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.