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

<%@ Language=VBScript %>
<HTML>
<HEAD>
</HEAD>
<BODY>
<FORM method=post action=opencnn.asp name=form1>
    <TABLE width=100%  height=160>
       <TR><TD valign=top bgcolor="#a5bace" width=10%>
         <font size=+1><b>Database</b></font>
         <center><P>
           <A href="open.asp?Operator=NewDB">New</A><br>
            <A href="open.asp?Operator=OpenDB">Open</A></P></Center>
       </TD>
<%operator = Request.QueryString("Operator") 
if operator = "nothing" then%>
        <TD align=center bgcolor="#EEEEEE" width=90%> </TD>
<%elseif operator = "NewDB" then%>
       <TD align=center bgcolor="#EEEEEE" width=90%><b>
           <font size=+2>Presently, this function isn't supported.</font></b></TD>
<%elseif operator = "OpenDB" then
    dim path,dbpath,pos

    path = Server.mappath("open.asp")
    path = replace(path, "\", "/")
    pos = InStr(1,path,"vbscript")
    dbpath = Left(path,pos - 1) & "database/CloudscapeDB"

    drvIdx = Request.QueryString("drvtxt")

    dim DrvArry(14) '(17)
    DrvArry(0) = "--Please select a driver--"
    DrvArry(1) = "sun.jdbc.odbc.JdbcOdbcDriver (Access)"
    DrvArry(2) = "sun.jdbc.odbc.JdbcOdbcDriver (SQLServer)"
    DrvArry(3) = "oracle.jdbc.driver.OracleDriver (Oracle)"
    DrvArry(4) = "com.informix.jdbc.IfxDriver (Informix)"
    DrvArry(5) = "twz1.jdbc.mysql.jdbcMysqlDriver (MySQL)"
    DrvArry(6) = "org.gjt.mm.mysql.Driver (MySQL)"
    DrvArry(7) = "com.sybase.jdbc2.jdbc.SybDriver (Sybase)"
    DrvArry(8) = "COM.cloudscape.core.JDBCDriver (Cloudscape)"
    DrvArry(9) = "intersolv.jdbc.sequelink.SequeLinkDriver (Oracle)"
    DrvArry(10) = "intersolv.jdbc.sequelink.SequeLinkDriver (Informix)"
    DrvArry(11) = "intersolv.jdbc.sequelink.SequeLinkDriver (Sybase)"
    DrvArry(12) = "intersolv.jdbc.sequelink.SequeLinkDriver (SQLServer)"
    DrvArry(13) = "intersolv.jdbc.sequelink.SequeLinkDriver (Access)"
    DrvArry(14) = "openlink.jdbc2.Driver (SQLServer)"

    'DrvArry(15) = "com.imaginary.sql.msql.MsqlDriver (MiniSQL)"
    'DrvArry(16) = "solid.jdbc.SolidDriver"
    'DrvArry(17) = "symantec.itools.db.jdbc.Driver"
%>
      <TD bgcolor="#EEEEEE" width=90%>

         <TABLE border=0 width=100% cellspacing=5 cellpadding=2>
            <TR><TD width=2%> </TD>
               <TD width=10%><B>Driver:</B></TD>
               <TD width=2%> </TD>
               <TD width=86%>
                  <TABLE border=0 cellspacing=0 cellpadding=0><TD><TD width=340>
                     <SELECT name=drvtxt width=340 style="WIDTH: 340px" onChange="drvtxt_onChange();">
                     <%for i=0 to ubound(DrvArry)
                        if i = drvIdx then%>
                           <OPTION value=<%=i%> selected><%=DrvArry(i)%></OPTION>
                        <%else%>
                             <OPTION value=<%=i%>><%=DrvArry(i)%></OPTION>
                          <%end if%>
                     <%next%>
                     </SELECT></TD>
                     <TD width=80 align=center><INPUT name=openCnn type=submit value=" Open "></TD>
                     <TD><INPUT name=reset1 type=reset value=" Reset"></TD></TR></TABLE>
               </TD></TR>
            <TR><TD width=2%> </TD>
               <TD width=10%><B>Url:</B></TD>
               <TD width=2%> </TD>
               <TD width=86%><INPUT type=textbox name=urltxt size=70></TD></TR>
            <TR><TD width=2%> </TD>
               <TD width=10%><STRONG>UID:</STRONG></TD>
               <TD width=2%> </TD>
               <TD width=86%><INPUT type=textbox name=uidtxt size=70></TD></TR>
            <TR><TD width=2%> </TD>
               <TD width=10%><STRONG>PWD:</STRONG></TD>
               <TD width=2%> </TD>
               <TD width=86%><INPUT name=pwdtxt type=password size=70></TD></TR>
         </TABLE></TD>
   <%end if%>
      </TR></TABLE>

</FORM>

</BODY>
</HTML>

<SCRIPT language=JavaScript>
function openCnn_onclick(){
   if (document.form1.drvtxt.selectedIndex == 0){
      alert("Please a database driver.");
      return;
   }
   document.form1.submit();
}

function drvtxt_onChange(){
   switch ( document.form1.drvtxt.selectedIndex ){
   case 0:
     document.form1.urltxt.value = "";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 1:
     document.form1.urltxt.value = "{jdbc:odbc:AccessDB}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 2:
     document.form1.urltxt.value = "{jdbc:odbc:SQLServerDB}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
   case 3:
     document.form1.urltxt.value = "{jdbc:oracle:thin:@<HostIP>:1521:<SID>}";
     document.form1.uidtxt.value = "HALCYON";
     document.form1.pwdtxt.value = "HALCYON";
     break;
    case 4:
     document.form1.urltxt.value = "{jdbc:informix-sqli://<HostIP>:1526/InformixDB:informixserver=kingdbsvr;user=informix;password=miss}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
    case 5:
     document.form1.urltxt.value = "{jdbc:z1MySQL://<HostIP>:3306/MySQLDB}";
     document.form1.uidtxt.value = "root";
     document.form1.pwdtxt.value = "";
     break;
    case 6:
     document.form1.urltxt.value = "{jdbc:mysql://<HostIP>:3306/MySQLDB}";
     document.form1.uidtxt.value = "root";
     document.form1.pwdtxt.value = "";
     break;
    case 7:
     document.form1.urltxt.value = "{jdbc:sybase:Tds:<HostIP>:5000/SybaseDB}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
    case 8:
     document.form1.urltxt.value = "{jdbc:cloudscape:<%=dbpath%>}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 9:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4003/[Oracle];OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "HALCYON";
     document.form1.pwdtxt.value = "HALCYON";
     break;
   case 10:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4004/[Informix];Database=InformixDB;OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 11:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4005/[Sybase];Database=SybaseDB;OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
   case 12:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4006/[SQLServer];Database=SQLServerDB;OSUser=john;OSPassword=whatever}";
     document.form1.uidtxt.value = "sa";
     document.form1.pwdtxt.value = "";
     break;
   case 13:
     document.form1.urltxt.value = "{jdbc:sequelink://<HostIP>:4011/[ODBC MS Access];Database=c:\\database\\AccessDB.mdb;}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 14:
     document.form1.urltxt.value = "{jdbc:openlink://<HostIP>/DSN=SQLServerDB/UID=sa/PWD=}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
              
   case 16:
     document.form1.urltxt.value = "{jdbc:msql://<HostIP>:1114/MiniSQLDB}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 17:
     document.form1.urltxt.value = "{jdbc:solid://<HostIP>:<port>/<UID>/<PWD>}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
     break;
   case 18:
     document.form1.urltxt.value = "{jdbc:dbaw://< Host IP >:8889/MS_ACCESS/BIBLIO/BIBLIO}";
     document.form1.uidtxt.value = "";
     document.form1.pwdtxt.value = "";
   }
}

</SCRIPT>

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