Search SSIS and DTS Packages with SSIS-DTS Package Search from Gerasus Software
  Gerasus Software

Helpful Tools for SQL Server Pros

Free Downloads

                 

Source code for CreateDTS.hta

<html>
<head>
 <title>Create DTS Package</title>
 <HTA:APPLICATION ID="HTACDP"
 APPLICATIONNAME="HTACDP"
 ICON="e.ico"
 SCROLL="no">
</head>

<body bgcolor="#bbbbbb" fgcolor="White" onload=window_onload()>
    <table border=0>
        <tr>
            <td align=left>Package name:</td><td><input type=text id=packageName size=30 /></td>
        </tr>
        <tr><td> </td><td> </td></tr>      
        <tr><td> </td><td> </td></tr>      
        <tr><td align=left>Save Location:</td><td>Structured Storage File</td></tr>
        <tr><td> </td><td> </td></tr>      
        <tr><td align=left>File Name:</td><td><input type=text id=packageFile /> <input type=button id=saveFileButton value="Save To File" onclick=savePackage("F") /></td></tr>      
        <tr><td> </td><td> </td></tr>      
        <tr><td> </td><td> </td></tr>      
        <tr><td align=left>Save Location:</td><td>Sql Server</td></tr>
        <tr><td> </td><td> </td></tr>      
        <tr><td> </td><td><select id="authentication">
                                    <option value="W" selected>Use Windows Authentication
                                    <option value="S">Use SQL Server Authentication
                               </select>
        </td></tr>
        <tr><td align=left>Server:</td><td><input type=text id=server /></td></tr>
        <tr><td align=left>User Name:</td><td><input type=text id=user /></td></tr>
        <tr><td align=left>Password:</td><td><input type=password id=password /></td></tr>
        <tr><td align=left> </td><td><input type=button id=Button1 value="Save To Sql Server" onclick=savePackage("S") /></td></tr>
    </table>
    
  

    <script language="JScript">
        function window_onload() {
            window.resizeTo(410,450)
        }
  
        function savePackage(destination) {
            try {
                var DTSSQLStgFlag_UseTrustedConnection = 256;
                var DTSSQLStgFlag_Default = 0;
                var pkg = new ActiveXObject("DTS.Package2");
                if (pkg == null)
                    alert("pkg is null");
                if (destination == "F") {
					var doIt = confirm("Create DTS package " + packageName.value + " in file " + packageFile.value + "?");
					if (doIt) {
						pkg.Name = packageName.value;
						pkg.SaveToStorageFile(packageFile.value, "", "", null, false);
					}
                } else {
					var doIt = confirm("Create DTS package " + packageName.value + " on Sql Server " + server.value + "?");
					if (doIt) {
					    pkg.Name = packageName.value;
						if (authentication.value == "W") {
							//pkg.SaveToSQLServer(server.value, null, null, DTSSQLStgFlag_UseTrustedConnection, null, null, null, null, null)
						    pkg.SaveToSQLServer(server.value, "", "", DTSSQLStgFlag_UseTrustedConnection, "", "", "", null, false);
	            		} else {
    	            		pkg.SaveToSQLServer(server.value, user.value, password.value, DTSSQLStgFlag_Default, "", "", "", null, false);
						}
					}
                }
            }
            catch (e) {
                alert("CreateDTS.hta : exception occurred :\n" + e);
            }
        }
    </script>
</body>
</html>

 

 

2007-2010 Gerasus Software. All rights reserved.