-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathadmin2.asp
96 lines (81 loc) · 2.61 KB
/
admin2.asp
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
<%@ language="JavaScript" %>
<!--
///////////////////////////////////////////////////////////////////////////////
// Product : Online Tools(tm)
//
// Series : Dovetail Software Development Series(tm)
//
// Name : admin2.asp
//
// Description : Server page that updates the database information
//
// Author : Dovetail Software, Inc.
// 4807 Spicewood Springs Rd, Bldg 4 Suite 200
// Austin, TX 78759
// (512) 610-5400
// EMAIL: [email protected]
// www.dovetailsoftware.com
//
// Platforms : This version supports Clarify 9.0 and later
//
// Copyright (C) 2001-2012 Dovetail Software, Inc.
// All Rights Reserved.
///////////////////////////////////////////////////////////////////////////////
-->
<!--#include file="inc/config.inc"-->
<!--#include file="inc/json.asp"-->
<%
var result = {};
result.success = true;
result.message = "";
result.errorMessage = "";
try {
var Provider = Request("Provider");
var UserID = Request("UserID");
var Password = Request("Password");
var Database = Request("Database");
var DBServer = Request("DBServer");
var FSO = Server.CreateObject("Scripting.FileSystemObject");
//Build up the new UDL Info String
var UDLString = "Provider=";
UDLString += Provider;
UDLString += ";Password=";
UDLString += Password;
UDLString += ";User ID=";
UDLString += UserID;
UDLString += ";Data Source=";
UDLString += DBServer;
UDLString += ";Persist Security Info=True";
//Initial File Name="";Server SPN=""
result.message = "Database set to: ";
if(Provider == "SQLOLEDB.1" || Provider == "SQLNCLI11.1") {
UDLString += ";Initial Catalog=";
UDLString += Database;
result.message += Database + " on Server: " + DBServer;
} else {
result.message += DBServer;
}
if(Provider == "SQLNCLI11.1") {
UDLString += ";Initial File Name=\"\";Server SPN=\"\"";
}
//Get the Connection String & extract the actual file name
var TheFile = dbConnect;
TheFile = TheFile.replace("File Name=", "");
//Create a new Text File (file_name,overwrite,unicode)
UDL = FSO.CreateTextFile(TheFile,true,true);
//Write out the info to the new UDL file
UDL.WriteLine("[oledb]");
UDL.WriteLine("; Everything after this line is an OLE DB initstring");
UDL.WriteLine(UDLString);
//Close the File
UDL.Close();
//Cleanup
UDL = null;
FSO = null;
} catch(e) {
result.success = false;
result.errorMessage = e.description;
}
Response.Clear();
Response.Write(JSON.stringify(result));
%>