VBScript Sample: vbscript/ado/webaccess/newtb.asp
   ASP Script
   Comments or Client-side Script
   HTML and Text

<%@  Language=VBScript  %>
<HTML>
<HEAD>
<SCRIPT language=JavaScript>
  dbms = "<%=Request.QueryString("dbms")%>";

function ChgType(){
  typeVal =  parseInt(document.form1.fdType.selectedIndex);
   switch ( typeVal ) {
  case  12:
  case  13:
   document.form1.fdSize.value = "18,  0";
   break;
  case  26:
  case 29:
   case 32:
   document.form1.fdSize.value =  "10";
   break;
  case  27:
  case 20:
   case 33:
   document.form1.fdSize.value =  "50";
   break;
   default:
   document.form1.fdSize.value = "";
   }
  }

  function addField_onClick(){
   var name = document.form1.fdName.value;
  if  (name.length <  1){
  alert("Field name is required.");
   return;
  }
  ch  = name.charAt(0);
  if (ch < 'A' || (ch  > 'Z' && ch < 'a') || ch > 'z')     {
  alert("Invalid field name.");
   return;
  } 
   for (i = 0; i < name.length; i++) {
   ch =  name.charAt(i);
   if ( (ch < '0' || (ch > '9' && ch < 'A') || (ch  >    'Z' && ch < 'a') || ch > 'z') && ch != '_'  ){
  alert("Invalid field name.");
   return;
  }
   }

 if (document.form1.fdType.selectedIndex  == 0) {
   alert("Please select a field type.");
   return;
  }
  if  ( (document.form1.fdType.selectedIndex == 25 ||  document.form1.fdType.selectedIndex == 26 ||  
   document.form1.fdType.selectedIndex == 27 || document.form1.fdType.selectedIndex == 29 || 
  document.form1.fdType.selectedIndex  == 30 || document.form1.fdType.selectedIndex == 32 ||  
  document.form1.fdType.selectedIndex == 33 )  && 
  ( isNaN(  parseInt(document.form1.fdSize.value) ) || parseInt(document.form1.fdSize.value) == 0 )
  )  {
  alert("Field size is requested.");
   return;
   }

 if ( document.form1.fdType.selectedIndex  == 12 || document.form1.fdType.selectedIndex == 13 )  {
  if  (document.form1.fdSize.value == "")  {
   alert("Please enter a number in the format of: 18, 0");
   return;
   }
  pos =  document.form1.fdSize.value.indexOf(",");
   if ( pos == -1 )  {
   alert("Please enter a number in the format of: 18, 0");
   return;
   }
  if ( isNaN(  parseInt(document.form1.fdSize.value.substring(0, pos)) )     ||
   parseInt(document.form1.fdSize.value.substring(0, pos)) == 0 )  {
   alert("Please enter a number in the format of: 18, 0");
   return;
   }
  if ( isNaN(  parseInt(document.form1.fdSize.value.substring(pos + 1)) )     ||
   parseInt(document.form1.fdSize.value.substring(0, pos + 1)) == 0 )  {
   alert("Please enter a number in the format of: 18, 0");
   return;
   }
  }

 var  lstLen = document.form1.listName.length;
  for  (i = 0; i < lstLen; i++)  {
  if  (document.form1.listName.options[i].text == document.form1.fdName.value)     {
   alert("Field name already exists.");
   return;
   }
  }

  adoType =  document.form1.fdType.options[document.form1.fdType.selectedIndex].text;
   fdT = fieldDataType(adoType);
  if  (fdT.indexOf("Error:") != -1)  {
  alert("The field type, ( " + adoType + " ), is not supported by the specified DBMS.");
  return  ;
  }

  document.form1.listName.length = lstLen + 1;
   document.form1.listFields.length = lstLen + 1;
   document.form1.listType.length = lstLen + 1;
   document.form1.listSize.length = lstLen +  1;

  document.form1.listName.options[lstLen].text = document.form1.fdName.value;
   document.form1.listFields.options[lstLen].text = document.form1.fdName.value;

  document.form1.listType.options[lstLen].text = adoType;
   document.form1.listType.options[lstLen].value = fdT;

 if (  document.form1.fdType.selectedIndex == 25 || document.form1.fdType.selectedIndex == 26 || 
   document.form1.fdType.selectedIndex == 27 || document.form1.fdType.selectedIndex == 29 || 
  document.form1.fdType.selectedIndex  == 30 || document.form1.fdType.selectedIndex == 32 ||  
  document.form1.fdType.selectedIndex == 33  )
   document.form1.listSize.options[lstLen].text = document.form1.fdSize.value;
   else
   document.form1.listSize.options[lstLen].text = "";

 document.form1.fdName.value = "";
  document.form1.fdType.selectedIndex = 27;
  document.form1.fdSize.value = "50";
   document.form1.fdName.focus();
  }

function  ridField_onClick(){
  list = document.form1.listName;
  index = list.options.selectedIndex;

 if ( index  < 0 || index >= list.length )
   return;

 for ( i = index; i <  list.length - 1; i++ )  {
   document.form1.listName.options[i].text = document.form1.listName.options[i + 1].text;
   document.form1.listType.options[i].text = document.form1.listType.options[i + 1].text;
   document.form1.listType.options[i].value = document.form1.listType.options[i + 1].value;
   document.form1.listSize.options[i].text = document.form1.listSize.options[i + 1].text;
   document.form1.listFields.options[i].text = document.form1.listFields.options[i + 1].text;
  }
   list.length = list.length -1
   document.form1.listFields.length = list.length;
  document.form1.listType.length = list.length;
  document.form1.listSize.length = list.length;
  }

function  listName_onChange(){
  NameIdx =  document.form1.listName.selectedIndex;

  document.form1.listType.selectedIndex = NameIdx;
  document.form1.listSize.selectedIndex = NameIdx;
   //document.form1.listFields.selectedIndex = NameIdx;
  }

function  listType_onChange(){
  TypeIdx = document.form1.listType.selectedIndex;

  document.form1.listName.selectedIndex =  TypeIdx;
  document.form1.listSize.selectedIndex  = TypeIdx;
  }

function  listSize_onChange(){
  SizeIdx =  document.form1.listSize.selectedIndex;

  document.form1.listType.selectedIndex = SizeIdx;
  document.form1.listName.selectedIndex  = SizeIdx;
  }

function  listFields_onChange(){
  var  tmp1,tmp2;
   document.form1.listName.selectedIndex = -1
   document.form1.listType.selectedIndex = -1;
   document.form1.listSize.selectedIndex = -1;
   
  selidx =  document.form1.listFields.selectedIndex;
  if (  selidx > -1 && selidx < document.form1.listFields.length    )  {
  tmp1 =  document.form1.idxFields.value;
  tmp2 =  document.form1.listFields.options[selidx].text;

  if (tmp2 != "")  {
   if ( tmp1.indexOf(" " + tmp2 + ",") == -1)  {
   document.form1.idxFields.value = tmp1 + " " + tmp2 +  ",";
   }
   }
  }
   document.form1.listFields.selectedIndex = -1;
  }

function  Up_onClick(){
  selectIdx =  document.form1.listName.selectedIndex;
  if  (selectIdx <= 0 || selectIdx >= document.form1.listName.length     )
   return;

 tmp =  document.form1.listName.options[selectIdx -  1].text;
   document.form1.listName.options[selectIdx - 1].text =  document.form1.listName.options[selectIdx].text;
   document.form1.listName.options[selectIdx].text =  tmp;

 tmp =  document.form1.listType.options[selectIdx -  1].text;
   document.form1.listType.options[selectIdx - 1].text =  document.form1.listType.options[selectIdx].text;
   document.form1.listType.options[selectIdx].text =  tmp;

 tmp =  document.form1.listType.options[selectIdx -  1].value;
   document.form1.listType.options[selectIdx - 1].value =  document.form1.listType.options[selectIdx].value;
   document.form1.listType.options[selectIdx].value =  tmp;

  tmp =  document.form1.listSize.options[selectIdx -  1].text;
   document.form1.listSize.options[selectIdx - 1].text =  document.form1.listSize.options[selectIdx].text;
   document.form1.listSize.options[selectIdx].text =  tmp;
   
  tmp =  document.form1.listFields.options[selectIdx -  1].text;
   document.form1.listFields.options[selectIdx - 1].text =  document.form1.listFields.options[selectIdx].text;
   document.form1.listFields.options[selectIdx].text =  tmp;
   
  document.form1.listName.selectedIndex =  selectIdx - 1;
  document.form1.listType.selectedIndex = selectIdx -  1;
  document.form1.listSize.selectedIndex =  selectIdx - 1;
  document.form1.listFields.selectedIndex = selectIdx - 1;
  }

function  Down_onClick(){
  selectIdx =  document.form1.listName.selectedIndex;
  if  (selectIdx < 0 || selectIdx >= document.form1.listName.length -     1)
   return;

 tmp =  document.form1.listName.options[selectIdx +  1].text;
   document.form1.listName.options[selectIdx + 1].text =  document.form1.listName.options[selectIdx].text;
   document.form1.listName.options[selectIdx].text =  tmp;

 tmp =  document.form1.listType.options[selectIdx +  1].text;
   document.form1.listType.options[selectIdx + 1].text =  document.form1.listType.options[selectIdx].text;
   document.form1.listType.options[selectIdx].text =  tmp;

 tmp =  document.form1.listType.options[selectIdx +  1].value;
   document.form1.listType.options[selectIdx + 1].value =  document.form1.listType.options[selectIdx].value;
   document.form1.listType.options[selectIdx].value =  tmp;

 tmp =  document.form1.listSize.options[selectIdx +  1].text;
   document.form1.listSize.options[selectIdx + 1].text =  document.form1.listSize.options[selectIdx].text;
   document.form1.listSize.options[selectIdx].text =  tmp;
   
  tmp =  document.form1.listFields.options[selectIdx +  1].text;
   document.form1.listFields.options[selectIdx + 1].text =  document.form1.listFields.options[selectIdx].text;
   document.form1.listFields.options[selectIdx].text =  tmp;
   
  document.form1.listName.selectedIndex =  selectIdx + 1;
  document.form1.listType.selectedIndex = selectIdx +  1;
  document.form1.listSize.selectedIndex =  selectIdx + 1;
  document.form1.listFields.selectedIndex = selectIdx + 1;
  }

function  Buildtb_onClick(){
  lstLen =  document.form1.listName.length;
  if (lstLen  < 1) {
   alert("No field.");
   return;
  }
   //check table name
  var name =  document.form1.newtbName.value;
  if  (name.length <  1){
  alert("Table name is required.");
   return;
  }
  ch  = name.charAt(0);
  if (ch < 'A' || (ch  > 'Z' && ch < 'a') || ch > 'z')     {
  alert("Invalid table name.");
   return;
  } 
   for (i = 0; i < name.length; i++) {
   ch =  name.charAt(i);
   if ( (ch < '0' || (ch > '9' && ch < 'A') || (ch  >    'Z' && ch < 'a') || ch > 'z') && ch != '_'  ){
  alert("Invalid table name.");
   return;
  }
   }
  // Build the Create Table SQL statement
  document.form1.TbSQL.value =  createTbSQL();

 list =  document.form1.listIndex;
  for (x = 0; x  <  list.length;x++){
   list.options[x].selected = true;
   }
  
   document.form1.submit();
   }

function  createTbSQL(){
  var  tmp;
  tmp =  document.form1.newtbName.value;

 Sqlsent =  "CREATE TABLE " + tmp + " (";

 lstLen =  document.form1.listName.length
  for(i = 0; i  < lstLen;  i++){
  fdN =  document.form1.listName.options[i].text;
   adoType =  document.form1.listType.options[i].text;
   fdT =  document.form1.listType.options[i].value;
   fdS =  document.form1.listSize.options[i].text;

  if (i != 0)  {
   Sqlsent = Sqlsent + ",  "
   }

 if ( adoType ==  "adChar" || adoType == "adVarChar"    || adoType == "adWChar"  ||
   adoType == "adVarWChar" || adoType == "adCurrency" ||    adoType == "adNumeric" )  {
   Sqlsent = Sqlsent + fdN + " " + fdT + "(" + fdS +     ")";
  } else if  (adoType == "adBinary" || adoType == "adVarBinary"     ){
   if (dbms == "MySQL")  {
   Sqlsent = Sqlsent + fdN + " " +  fdT;
   } else  {
   Sqlsent = Sqlsent + fdN + " " + fdT + "(" + fdS +     ")";
   }
  } else  {
   Sqlsent = Sqlsent + fdN + " " +  fdT;
  }  
  }
  Sqlsent =  Sqlsent + ")";

 return  Sqlsent;
  }

function  fieldDataType(adoType){
  if (dbms == "Access")  { //1
  switch (  adoType ) {
  case  "adTinyInt":
   FdType =  "BYTE";
   break;
  case  "adSmallInt":
   FdType =  "SMALLINT";
   break;
  case  "adInteger":
   FdType =  "INTEGER";
   break;
  case  "adUnsignedInt":
   FdType =  "COUNTER";
   break;
  case  "adSingle":
   FdType =  "REAL";
   break;
  case  "adDouble":
   FdType =  "DOUBLE";
   break;
  case  "adCurrency":
   FdType =  "CURRENCY";
   break;
  case  "adBoolean":
   FdType =  "BIT";
   break;
  case  "adGUID":
   FdType =  "GUID";
   break;
  case  "adDBTimeStamp":
   FdType =  "DATETIME";
   break;
  case  "adChar":
   FdType =  "CHAR";
   break;
  case  "adVarChar":
   FdType =  "VARCHAR";
   break;
  case  "adLongVarChar":
   FdType =  "LONGCHAR";
   break;
  case  "adBinary":
   FdType =  "BINARY";
   break;
  case  "adVarBinary":
   FdType =  "VARBINARY";
   break;
  case  "adLongVarBinary":
   FdType =  "LONGBINARY";
   break;
   default:
   FdType =  "Error:";
   }

 } else if (dbms == "SQLServer") {  //2
  switch (  adoType ) {
  case  "adTinyInt":
   FdType =  "tinyint"
   break;
  case  "adSmallInt":
   FdType =  "smallint";
   break;
  case  "adInteger":
   FdType =  "int";
   break;
  case  "adSingle":
   FdType =  "real";
   break;
  case  "adDouble":
   FdType =  "float";
   break;
  case  "adCurrency":
   FdType =  "money";
   break;
  case  "adDecimal":
   FdType =  "decimal";
   break;
  case  "adNumeric":
   FdType =  "numeric";
   break;
  case  "adBoolean":
   FdType =  "bit";
   break;
  case  "adGUID":
   FdType =  "uniqueidentifier";
   break;
  case  "adDBTimeStamp":
   FdType =  "datetime";
   break;
  case  "adChar":
   FdType =  "char";
   break;
  case  "adVarChar":
   FdType =  "varchar";
   break;
  case  "adLongVarChar":
   FdType =  "text"
   break;
  case  "adWChar":
   FdType =  "nchar";
   break;
  case  "adVarWChar":
   FdType =  "nvarchar";
   break;
  case  "adLongVarWChar":
   FdType =  "ntext";
   break;
  case  "adBinary":
   FdType =  "binary";
   break;
  case  "adVarBinary":
   FdType =  "varbinary";
   break;
  case  "adLongVarBinary":
   FdType =  "image";
   break;
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "MySQL") {  //3
  switch (  adoType ) {
  case  "adTinyInt":
   FdType =  "tinyint"
   break;
  case  "adSmallInt":
   FdType =  "smallint";
   break;
  case  "adInteger":
   FdType =  "int";
   break;
  case  "adBigInt":
   FdType =  "bigint";
   break;
  case  "adUnsignedTinyInt":
   FdType = "tinyint  unsigned";
   break;
  case  "adUnsignedSmallInt":
   FdType = "smallint  unsigned";
   break;
  case  "adUnsignedInt":
   FdType = "int  unsigned";
   break;
  case  "adUnsignedBigInt":
   FdType = "bigint  unsigned";
   break;
  case  "adSingle":
   FdType =  "float";
   break;
  case  "adDouble":
   FdType =  "double";
   break;
  case  "adDecimal":
   FdType =  "decimal";
   break;
  case  "adDBDate":
   FdType =  "date";
   break;
  case  "adDBTime":
   FdType =  "time";
   break;
  case  "adDBTimeStamp":
   FdType =  "datetime";
   break;
  case  "adChar":
   FdType =  "char";
   break;
  case  "adVarChar":
   FdType =  "varchar";
   break;
  case  "adLongVarChar":
   FdType =  "text";
   break;
  case  "adBinary":
   FdType =  "tinyblob";
   break;
  case  "adVarBinary":
   FdType =  "mediumblob";
   break;
  case  "adLongVarBinary":
   FdType =  "longblob";
   break;
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "Oracle" ) {  //4
  switch (  adoType ) {
  case  "adTinyInt":
   FdType =  "NUMBER(3,0)"
   break;
  case  "adSmallInt":
   FdType =  "SMALLINT";
   break;
  case  "adInteger":
   FdType =  "INT";
   break;
  case  "adBigInt":
   FdType =  "NUMBER";
   break;
  case  "adSingle":
   FdType =  "REAL";
   break;
  case  "adDouble":
   FdType =  "FLOAT";
   break;
  case  "adNumeric":
   FdType =  "NUMBER";
   break;
  case  "adBoolean":
   FdType =  "NUMBER(1,0)";
   break;
  case  "adDBTimeStamp":
   FdType =  "DATE";
   break;
  case  "adChar":
   FdType =  "CHAR";
   break;
  case  "adVarChar":
   FdType =  "VARCHAR2";
   break
  case  "adLongVarChar":
   FdType =  "LONG";
   break;
  case  "adVarBinary":
   FdType =  "RAW";
   break;
  case  "adLongVarBinary":
   FdType = "LONG  RAW";
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "Sybase" ) {  //5
  switch (  adoType ) {
  case  "adTinyInt":
   FdType =  "tinyint"
   break;
  case  "adSmallInt":
   FdType =  "smallint";
   break;
  case  "adInteger":
   FdType =  "int";
   break;
  case  "adSingle":
   FdType =  "real";
   break;
  case  "adDouble":
   FdType =  "float";
   break;
  case  "adCurrency":
   FdType =  "money";
   break;
  case  "adDecimal":
   FdType =  "decimal";
   break;
  case  "adNumeric":
   FdType =  "numeric";
   break;
  case  "adBoolean":
   FdType =  "bit";
   break;
  case  "adDBTimeStamp":
   FdType =  "datetime";
   break;
  case  "adChar":
   FdType =  "char";
   break;
  case  "adVarChar":
   FdType =  "varchar";
   break;
  case  "adLongVarChar":
   FdType =  "text";
   break;
  case  "adBinary":
   FdType =  "binary";
   break;
  case  "adVarBinary":
   FdType =  "varbinary";
   break;
  case  "adLongVarBinary":
   FdType =  "image";
   break;
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "Informix" ) {  //6
  switch (  adoType ) {
  case  "adSmallInt":
   FdType =  "smallint";
   break;
  case  "adInteger":
   FdType =  "integer";
   break;
  case  "adSingle":
   FdType =  "smallfloat";
   break;
  case  "adDouble":
   FdType =  "float";
   break;
  case  "adDecimal":
   FdType =  "decimal";
   break;
  case  "adNumeric":
   FdType =  "numeric";
   break;
  case  "adDBDate":
   FdType =  "date";
   break;
  case  "adDBTimeStamp":
   FdType =  "datetime";
   break;
  case  "adChar":
   FdType =  "char";
   break;
  case  "adVarChar":
   FdType =  "varchar";
   break;
  case  "adWChar":
   FdType =  "nchar";
   break;
  case  "adVarWChar":
   FdType =  "nvarchar";
   break;
  case  "adLongVarBinary":
   FdType = "byte";
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "Cloudscape" ) {  //7
  switch (  adoType ) {
  case  "adTinyInt":
   FdType =  "TINYINT"
   break;
  case  "adSmallInt":
   FdType =  "SMALLINT";
   break;
  case  "adInteger":
   FdType =  "INT";
   break;
  case  "adBigInt":
   FdType =  "LONGINT";
   break;
  case  "adSingle":
   FdType =  "REAL";
   break;
  case  "adDouble":
   FdType = "DOUBLE  PRECISION";
   break;
  case  "adDecimal":
   FdType =  "DECIMAL";
   break;
  case  "adNumeric":
   FdType =  "NUMERIC";
   break;
  case  "adBoolean":
   FdType =  "BOOLEAN";
   break;
  case  "adDBDate":
   FdType =  "DATE";
   break;
  case  "adDBTime":
   FdType =  "TIME";
   break;
  case  "adDBTimeStamp":
   FdType =  "TIMESTAMP";
   break;
  case  "adChar":
   FdType =  "CHAR";
   break;
  case  "adVarChar":
   FdType =  "VARCHAR";
   break;
  case  "adLongVarChar":
   FdType = "LONG  VARCHAR";
   break;
  case  "adBinary":
   FdType =  "BIT";
   break;
  case  "adVarBinary":
   FdType = "BIT  VARYING";
   break;
  case  "adLongVarBinary":
   FdType = "LONG BIT  VARYING";
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "Postgres" ) {  //8
  switch (  adoType ) {
  case  "adSmallInt":
   FdType =  "int2";
   break;
  case  "adInteger":
   FdType =  "ing4";
   break;
  case  "adBigInt":
   FdType =  "ing8";
   break;
  case  "adSingle":
   FdType =  "float4";
   break;
  case  "adDouble":
   FdType =  "float8";
   break;
  case  "adCurrency":
   FdType =  "money";
   break;
  case  "adBoolean":
   FdType =  "bool";
   break;
  case  "adDBDate":
   FdType =  "date";
   break;
  case  "adDBTime":
   FdType =  "time";
   break;
  case  "adDBTimeStamp":
   FdType =  "timestamp";
   break;
  case  "adChar":
   FdType =  "char";
   break;
  case  "adVarChar":
   FdType =  "varchar";
   break;
  case  "adLongVarChar":
   FdType = "text";
   default:
   FdType =  "Error:";
   }
  } else if ( dbms == "MiniSQL" ) {  //9
  }
  return  FdType;
  }

  function addIndex_onClick(){
   // check index name
  nameVal =  document.form1.idxName.value;
  if  (nameVal.length <  0){
  alert("Index name is required.");
   return;
  }
  ch  = nameVal.charAt(0);
  if (ch < 'A' ||  (ch > 'Z' && ch < 'a') || ch > 'z')     {
  alert("Invalid index name.");
   return;
  } 
   for (i = 0; i < nameVal.length; i++)  {
  ch =  nameVal.charAt(i);
   if ( (ch < '0' || (ch > '9' && ch < 'A') || (ch  >    'Z' && ch < 'a') || ch > 'z') && ch != '_'  ){
   alert("Invalid index name.");
   return;
   }
  }
  //check  field for index.
  nameVal =  document.form1.idxFields.value;
  if  (nameVal.length <  1){
  alert("No field name for index.");
   return;
   }

 var length =  document.form1.listIndex.length;
   document.form1.listIndex.length = length + 1;
   document.form1.listIndex.options[length].value =  AddIndexSQL();
   document.form1.listIndex.options[length].text =  document.form1.idxName.value;

  document.form1.listFields.selectedIndex = -1;
   document.form1.idxFields.value = "";
   document.form1.idxName.value = ""
   document.form1.unique.value = "";
  }

function  AddIndexSQL(){
  var  newTbName;
  newTbName =  document.form1.newtbName.value;
   
  bUnique =  document.form1.unique.value;
  if ( dbms ==  "Cloudscape" ) {
   if (bUnique == "" || bUnique == "n" || bUnique ==     "N")
   sqlsent = "CREATE BTREE INDEX  ";
   else
   sqlsent = "CREATE UNIQUE BTREE INDEX ";
  } else  {
  if (bUnique ==  "" || bUnique == "n" || bUnique ==     "N")
   sqlsent = "CREATE INDEX  ";
   else
   sqlsent = "CREATE UNIQUE INDEX ";
   }

 sqlsent = sqlsent +  document.form1.idxName.value + " ON " + newTbName    + " (" +  document.form1.idxFields.value;

 sqlsent = sqlsent.substring(0,  sqlsent.length - 1);
  sqlsent = sqlsent +  ")";
  
  return  sqlsent;
  }

function  ridIndex_onClick(){
  list =  document.form1.listIndex;
  selidx =  list.selectedIndex;
  if ( selidx < 0  || selidx >= list.length  )
   return;
  
  for  ( i = selidx; i < list.length - 1; i++ )  {
   list.options[i].text = list.options[i +  1].text;
   list.options[i].value = list.options[i +  1].value;
  }
   list.length = list.length - 1

  list.selectedIndex = -1;
   document.form1.listFields.selectedIndex = -1;
   document.form1.idxFields.value = "";
   document.form1.idxName.value = ""
   document.form1.unique.value = "";
  }

function  listIndex_onChange(){
  list =  document.form1.listIndex;
  selidx =  list.selectedIndex;
  if ( selidx < 0  || selidx >= list.length  )
   return;
  strValue =  list.options[selidx].value;
  if  (strValue.indexOf(" UNIQUE ") !=  -1)
   document.form1.unique.value = "Y";
   else
   document.form1.unique.value = "N";

 pos1 =  strValue.indexOf(" INDEX ");
  pos2 =  strValue.indexOf(" ON ");
   document.form1.idxName.value = strValue.substring(pos1 + 7,  pos2);

 pos1 = strValue.indexOf("  (");
  pos2 =  strValue.indexOf(")");

  document.form1.idxFields.value = strValue.substring(pos1 + 1, pos2) +     ",";
  }

</SCRIPT> </HEAD>
<BODY  bgcolor=Lavender>
<FORM method=POST action="opencnn.asp?dbms=<%=Request.QueryString("dbms")%>&NewTable=success"     name="form1" target=top>
  <TABLE border=0 cellspacing=0  cellpadding=0>
   <TR><TD>
   <TABLE>
   <TR>
   <TD><b>New Table Name:</b><INPUT name=newtbName  value=""></TD>
   <TD><INPUT name=Buildtb type=button value="Build Table" onClick="Buildtb_onClick();"></TD>
   </TR>
   </TABLE>

  <TABLE><TR>
   <TD><font  size=1><b>Name:</b></font><BR><INPUT type=textbox name=fdName value=""></TD>
   <TD><font  size=1><b>Type:</b></font><BR><SELECT name=fdType width=150 style="WIDTH: 150" onchange="ChgType()">
   <OPTION value=0>adEmpty
   <OPTION value=1>adTinyInt
   <OPTION value=2>adSmallInt
   <OPTION value=3>adInteger
   <OPTION value=4>adBigInt
   <OPTION value=5>adUnsignedTinyInt
   <OPTION value=6>adUnsignedSmallInt
   <OPTION value=7>adUnsignedInt
   <OPTION value=8>adUnsignedBigInt
   <OPTION value=9>adSingle
   <OPTION value=10>adDouble
   <OPTION value=11>adCurrency
   <OPTION value=12>adDecimal
   <OPTION value=13>adNumeric
   <OPTION value=14>adBoolean
   <OPTION value=15>adError
   <OPTION value=16>adUserDefined
   <OPTION value=17>adVariant  
   <OPTION value=18>adIDispatch  
   <OPTION value=19>adIUnknown  
   <OPTION value=20>adGUID
   <OPTION value=21>adDate  
   <OPTION value=22>adDBDate  
   <OPTION value=23>adDBTime
   <OPTION value=24>adDBTimeStamp  
   <OPTION value=25>adBSTR  
   <OPTION value=26>adChar  
   <OPTION value=27>selected>adVarChar
   <OPTION value=28>adLongVarChar
   <OPTION value=29>adWChar
   <OPTION value=30>adVarWChar
   <OPTION value=31>adLongVarWChar
   <OPTION value=32>adBinary
   <OPTION value=33>adVarBinary
   <OPTION value=34>adLongVarBinary  
   </SELECT></TD>
   <TD><font size=1><b>Size</b> or [<b>Precision</b>,<b>scale</b>]<b>:</b></font><BR>
   <INPUT type=textbox name=fdSize value=50  size=16></TD>
   </TR></TABLE>

  <TABLE><TR>
   <TD><INPUT name=addField type=button value=" Add Field " onClick="addField_onClick();"></TD>
   <TD><INPUT name=ridField type=button value="Remove Field" onClick="ridField_onClick();"></TD>
   </TR></TABLE>

  <TABLE><TR>
   <TD><SELECT name=listName 
size=8 WIDTH=150 style="WIDTH: 150" onChange="listName_onChange();">
   </SELECT></TD>
   <TD><SELECT name=listType size=8 WIDTH=150 style="WIDTH: 150" onChange="listType_onChange();">
   </SELECT></TD>
   <TD><SELECT name=listSize size=8 WIDTH=130 style="WIDTH: 130" onChange="listSize_onChange();">
   </SELECT></TD>
   <TD><P><INPUT name=Up type=button value="/\" onClick="Up_onClick();"></P>
   <P><INPUT name=Down type=button value="\/" onClick="Down_onClick();"></P></TD>
   <TD  width=10> </TD>
   </TR></TABLE>
   </TD>
   <TD>
   <TABLE>
   <TR><TD><font size=1><B>Indexes:</B></font><BR>
   <SELECT name=listIndex size=3 width=180 style="WIDTH:  180">
   </SELECT><BR>
   <INPUT name=addIndex type=button value="Add Index" onClick="addIndex_onClick();">
   <INPUT name=ridIndex type=button value="Del Index" onClick="ridIndex_onClick();">
   </TD></TR>

  <TR><TD><font size=1><B>Index  Name:</B></font><BR>
   <INPUT name=idxName size=16  value=""> 
   <INPUT name=unique type=textbox size=1 value=""> Unique (<B>y</B>/<B>n</B>)</TD>
   </TR>

  <TR><TD><font size=1><B>Available Fields:</B></font><BR>
   <SELECT name=listFields size=3 width=180 style="WIDTH: 180" onChange="listFields_onChange();">
   </SELECT>
   </TD></TR>

  <TR><TD><font size=1><B>Indexed Fields:</B><font><BR>
   <INPUT type=textbox name=idxFields size=23  value="">
   </TD></TR>
   </TABLE>
   </TD></TR></TABLE>
  </P>
   <INPUT type=hidden name=TbSQL size=4  value="">
  <INPUT type=hidden name=IdxSQL size=4  value="">
  </FORM>
  </BODY>
  </HTML>

 


Copyright © 1998-2002, Halcyon Software Inc. All rights reserved.