⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 database.asp

📁 可在线管理ACCESS数据库,可新建,修改,建表等如同本地操作数据库
💻 ASP
字号:
<%@ Language=VBScript %>
<!--#include file=scripts/inc_common.asp -->
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<meta NAME="GENERATOR" Content="Microsoft Visual Studio 6.0">
<link href="default.css" rel="stylesheet" type="text/css">
<title>DBA:<%=langCaptionDatabase%></title>
<script type="text/javascript" language="javascript" src="scripts/common.js" defer></script>
<script LANGUAGE="javascript" type="text/javascript">
<!--
var win;
function browseDB(){
	win = window.open("browse.asp", "browse", "innerHeight=400,height=400,innerWidth=300,width=300,status=no,resizable=no,menubar=no,toolbar=no,center=yes,scrollbars=yes", false);
}
function onDatabaseChange(dbpath){
	var obj = document.getElementById('iPath');
	if(obj){
		obj.value = dbpath;
	}
	obj = document.getElementById('cbNew');
	if(obj){
		obj.checked = false;
	}
}
function removeDBPath(){
	var obj = document.getElementById("selDB");
	if(obj){
		window.location.href = "database.asp?action=remove_path&path=" + escape(obj.options[obj.selectedIndex].value);
	}
}
//-->
</script>
</head>
<body>
<%
	On Error Resume Next
	dim dba, action, arrDatabases, i, path, filesize
	action = CStr(Request("action").Item)
	set dba = new DBAdmin
	if Request.Form("submit").Count > 0 then
		if Request.Form("new") = "1" then dba.CreateDatabase Request.Form("path") else dba.Connect Request.Form("path"), Request.Form("password")
		if not dba.HasError then 
			Session(DBA_cfgSessionDBPathName) = dba.DatabasePath
			Session(DBA_cfgSessionDBPassword) = CStr(Request.Form("password").Item)
			
			DBA_AppendDatabase CStr(Request.Form("path").Item)
		end if
	elseif Len(Session(DBA_cfgSessionDBPathName)) > 0 then
		dba.Connect Session(DBA_cfgSessionDBPathName), Session(DBA_cfgSessionDBPassword)
	end if
%>

<%call DBA_WriteNavigation%>

<!--DATABASE OPTIONS-->
<%
if action = "remove_path" then call DBA_RemoveDatabase(Request.QueryString("path").Item)

if Len(Session(DBA_cfgSessionDBPathName)) > 0 then
	call DBA_BeginNewTable(langDatabaseOptions, "", "75%", "")
	
	Select Case action
		Case "compact"
			call dba.CompactDatabase(Request.QueryString("upgrade") = "1", null, null)
			if not dba.HasError then DBA_WriteSuccess langDatabaseCompacted
		Case "backup"
			call dba.BackupDatabase
			if not dba.HasError then DBA_WriteSuccess langBackupCreated
		Case "restore"
			call dba.RestoreDatabase
			if not dba.HasError then DBA_WriteSuccess langBackupRestored
		Case "update_password"
			if Request.Form("password").Item = Request.Form("password2").Item then
				call dba.CompactDatabase(False, CStr(Request.Form("password").Item), null)
				if not dba.HasError then 
					DBA_WriteSuccess langNewPasswordSet
					Session(DBA_cfgSessionDBPassword) = CStr(Request.Form("password").Item)
				else
					DBA_WriteError dba.LastError
				end if
			else
				DBA_WriteError langPasswordsMismatch
			end if
		Case "set_lcid"
				call dba.CompactDatabase(False, null, Request.Form("lcid").Item)
	End Select
	if dba.HasError Then call DBA_WriteError(dba.LastError)
	
	if Request.QueryString("action").Count > 0 and dba.HasError then DBA_WriteError dba.LastError
	filesize = dba.Size
%>
	<fieldset>
	<legend><%=langProperties%></legend>
	<table border="0">
		<tr>
			<td><b><%=langFileSize%></b></td>
			<td><%=FormatNumber(filesize, 0, False, False, True)%> 字节</td>
		</tr>
		<tr>
			<td><b><%=langSizeAfterCompact%></b></td>
			<td><%=FormatNumber(filesize - dba.ReclaimedSpace, 0, False, False, True)%> 字节 (- <%=FormatNumber(dba.ReclaimedSpace, 0, True, False, True)%> 字节)</td>
		</tr>
		<tr>
			<td><b><%=langLocaleIdentifier%></b></td>
			<td><%=GetLocaleName(dba.LocaleIdentifier)%></td>
		</tr>
		<tr>
			<td><b><%=langDatabaseType%></b></td>
			<td><%if dba.IsAccess97 then Response.Write "Access 97" else Response.Write "Access 2000"%></td>
		</tr>
	</table>
	</fieldset>
	
	<fieldset title="<%=langActions%>">
	<legend><%=langActions%></legend>
	<p align="center"><%=langAffectCurrent%></p>
	<table align="center" border="0">
<%	if dba.IsAccess97 then%>
		<tr><td align="center"><a href="database.asp?action=compact&amp;upgrade=1" title="<%=langConvert2000Alt%>"><%=langConvert2000%></a></td></tr>
<%	end if%>
		<tr><td align="center"><a href="database.asp?action=compact" title="<%=langCompactRepairAlt%>"><%=langCompactRepair%></a></td></tr>
		<tr><td align="center"><a href="database.asp?action=backup" title="<%=langMakeBackupAlt%>"><%=langMakeBackup%></a></td></tr>
		<tr><td align="center"><a href="database.asp?action=restore" title="<%=langRestoreBackupAlt%>"><%=langRestoreBackup%></a></td></tr>
		<tr><td align="center"><a href="export_db.asp" title="<%=langDatabaseExportAlt%>"><%=langDatabaseExport%></a></td></tr>
		<tr><td align="center"><a href="import_db.asp" title="<%=langImportDatabaseAlt%>"><%=langImportDatabase%></a></td></tr>
		<tr><td align="center"><a href="database.asp?action=new_lcid" title="<%=langChangeLocaleIDAlt%>"><%=langChangeLocaleID%></a></td></tr>
<%		if action = "new_lcid" Then%>
			<tr><td align="center">
			<form action="database.asp" method="post">
			<input type="hidden" name="action" value="set_lcid">
			<table align="center" border="0">
				<tr><td><%=langNewLocaleID%></td><td><select name="lcid"><%call GetLocaleIDOptions%></select></td></tr>
				<tr><td colspan="2" align="center"><input type="submit" value="<%=langChangeLocaleID%>" class="button"></td></tr>
			</table>
			</form>
			</td></tr>
<%		end if%>
		<tr><td align="center"><a href="database.asp?action=newpassword" title="<%=langNewDatabasePassword%>"><%=langNewDatabasePassword%></a></td></tr>
<%		if action = "newpassword" and Request.Form("password").Count = 0 then%>
			<tr><td align="center"><p align="center"><%=langNewDatabasePasswordAlt%></p>
			<form action="database.asp" method="post">
			<input type="hidden" name="action" value="update_password">
			<table align="center" border="0">
				<tr><td><%=langNewPassword%></td><td><input type="password" name="password"></td></tr>
				<tr><td><%=langRetypeNewPassword%></td><td><input type="password" name="password2"></td></tr>
				<tr><td align="center" colspan="2"><input type="submit" name="submit_password" value="<%=langChangePassword%>" class="button"></td></tr>
			</table>
			</form></td></tr>
<%		end if%>
	</table></fieldset>
<%
	call DBA_EndNewTable
end if
%>


<!--DATABASE SELECTION-->
<%call DBA_BeginNewTable(langDatabaseSelection, langDatabaseSelectionAlt, "75%", "")%>
<p align="center"><%=langEnterPath%></p>

<%if Request.Form("submit").Count > 0 and dba.HasError then DBA_WriteError dba.LastError%>

<form action="database.asp" method="post">
<table align="center" border="0">
	<tr>
		<td><%=langDatabasePath%></td>
		<td>
			<input type="text" name="path" id="iPath">&nbsp;
			<input type="button" value="<%=langBrowseButton%>" class="button" onclick="javascript:browseDB();">
		</td>
	</tr>
	<tr>
		<td><%=langDatabasePassword%></td>
		<td><input type="password" name="password"></td>
	</tr>
	<tr>
		<td align="center" colspan="2"><input type="checkbox" value="1" name="new" id="cbNew" title="<%=langCreateNewAlt%>">&nbsp;<%=langCreateNew%></td>
	</tr>
	<tr><td colspan="2">&nbsp;</td></tr>
	<tr><td align="center" colspan="2"><%=langSelectExistingDatabase%></td></tr>
	<tr>
		<td align="center" colspan="2">
			<select name="db" id="selDB" onchange="javascript:onDatabaseChange(this.options[this.selectedIndex].value);">
				<option value=""></option>
<%	
	arrDatabases = DBA_GetDatabases()
	for i=0 to ubound(arrDatabases)
		path = arrDatabases(i)
		if Len(path) > 15 then
			path =	Left(arrDatabases(i), InStr(4, arrDatabases(i), "\")) & "...\" &_
					Right(arrDatabases(i), Len(arrDatabases(i)) - InStrRev(arrDatabases(i), "\"))
		end if
%>
				<option value="<%=arrDatabases(i)%>"><%=path%></option>
<%	next%>
			</select>&nbsp;<a href="javascript:removeDBPath();"><img src="images/delete.gif" border="0" width="16" height="16" alt="<%=langRemoveDBPathAlt%>"></a>
		</td>
	</tr>
	<tr>
		<td align="center" colspan="2"><input type="submit" name="submit" value="<%=langOpenDatabase%>" class="button"></td>
	</tr>
</table>
</form>
<%
	call DBA_EndNewTable
	set dba = Nothing
%>

<!--#include file=scripts/inc_footer.inc-->
</body>
</html>

<%
	Function GetLocaleName(lcid)
		Select Case lcid
			Case 1033	GetLocaleName = "常规"
			Case 2052	GetLocaleName = "中文标点"
			Case 133124	GetLocaleName = "中文笔画"
			Case 1028	GetLocaleName = "中文笔画(台湾)"
			Case 197636	GetLocaleName = "中文拼音(台湾)"
			Case 1050	GetLocaleName = "克罗地亚语"
			Case 1029	GetLocaleName = "捷克语"
			Case 1061	GetLocaleName = "爱沙尼亚语"
			Case 1036	GetLocaleName = "法语"
			Case 66615	GetLocaleName = "格鲁吉亚语(现代)"
			Case 66567	GetLocaleName = "德语(电话簿)"
			Case 1038	GetLocaleName = "匈牙利语"
			Case 66574	GetLocaleName = "匈牙利语(技术术语)"
			Case 1039	GetLocaleName = "冰岛语"
			Case 1041	GetLocaleName = "日语"
			Case 66577	GetLocaleName = "日语(Unicode)"
			Case 1042	GetLocaleName = "韩语"
			Case 66578	GetLocaleName = "韩语(Unicode)"
			Case 1062	GetLocaleName = "拉脱维亚语"
			Case 1036	GetLocaleName = "立陶宛语"
			Case 1071	GetLocaleName = "FYRO 马其顿语"
			Case 1044	GetLocaleName = "挪威语/丹麦语"
			Case 1045	GetLocaleName = "波兰语"
			Case 1048	GetLocaleName = "罗马尼亚语"
			Case 1051	GetLocaleName = "斯洛伐克语"
			Case 1060	GetLocaleName = "斯洛文尼亚语"
			Case 1034	GetLocaleName = "西班牙语(传统)"
			Case 3082	GetLocaleName = "西班牙语(西班牙)"
			Case 1053	GetLocaleName = "瑞典语/芬兰语"
			Case 1054	GetLocaleName = "泰国语"
			Case 1055	GetLocaleName = "土耳其语"
			Case 1058	GetLocaleName = "乌克兰语"
			Case 1066	GetLocaleName = "越南语"
			Case Else	GetLocaleName = "未知"
		End Select
	End Function
%>
<%	Sub GetLocaleIDOptions%>
			<option value="1033">常规</option>
			<option value="2052">中文标点</option>
			<option value="133124">中文笔画</option>
			<option value="1028">中文笔画(台湾)</option>
			<option value="197636">中文拼音(台湾)</option>
			<option value="1050">克罗地亚语</option>
			<option value="1029">捷克语</option>
			<option value="1061">爱沙尼亚语</option>
			<option value="1036">法语</option>
			<option value="66615">格鲁吉亚语(现代)</option>
			<option value="66567">德语(电话簿)</option>
			<option value="1038">匈牙利语</option>
			<option value="66574">匈牙利语(技术术语)</option>
			<option value="1039">冰岛语</option>
			<option value="1041">日语</option>
			<option value="66577">日语(Unicode)</option>
			<option value="1042">韩语</option>
			<option value="66578">韩语(Unicode)</option>
			<option value="1062">拉脱维亚语</option>
			<option value="1036">立陶宛语</option>
			<option value="1071">FYRO 马其顿语</option>
			<option value="1044">挪威语/丹麦语</option>
			<option value="1045">波兰语</option>
			<option value="1048">罗马尼亚语</option>
			<option value="1051">斯洛伐克语</option>
			<option value="1060">斯洛文尼亚语</option>
			<option value="1034">西班牙语(传统)</option>
			<option value="3082">西班牙语(西班牙)</option>
			<option value="1053">瑞典语/芬兰语</option>
			<option value="1054">泰国语</option>
			<option value="1055">土耳其语</option>
			<option value="1058">乌克兰语</option>
			<option value="1066">越南语</option>
<%	End Sub%>

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -