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

📄 index.asp

📁 源码!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!!
💻 ASP
📖 第 1 页 / 共 2 页
字号:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<%
Option Explicit
'creat by surnfu
' QQ : 31333716
'MSN :  surnfu@hotmail.com
'http://www.lc00.com
%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>数据库生成工具</title>
<style type="text/css">
body,div,td{
	font-family:"宋体";
	font-size:12px;
}
body{
	background-color:buttonface;
}
fieldset{
	margin-bottom:20px;
}

legend{
	height:16px;
	padding-left:5px;
	padding-top:5px;
	padding-right:5px;
	border:solid 1px #D0D0BF;
}
input, textarea{
	font-family:"宋体";
	font-size:12px;
	border-width:1px;
}
.input{
	width:60%;
}
table{
	border:solid 1px #D0D0BF;
	margin-top:10px;
	margin-left:10px;
	margin-bottom:10px;
	width:98%;
}
.Form td{
	border-bottom:dotted 1px #D0D0BF;
	line-height:25px;
	height:25px;
}
.Formtitle{
	text-align:right;
	font-weight:800;
}

.FormValue{
	text-align:left;
}
label{
	width:100px;
	margin-right:10px;
	color:#534D53;
	float:left;
}
span{
	margin-right:10px;
}

</style>
</head>
<body>
<%
Dim conn, DBtype, DBserverName, DBdataName, DBuserName, DBpassword, DBpath
Dim connStr
if Request.Form<>"" then
	On Error ReSume Next
	DBtype=Trim(Request.Form("DBtype"))
	DBserverName=Trim(Request.Form("DBserverName"))
	DBdataName=Trim(Request.Form("DBdataName"))
	DBuserName=Trim(Request.Form("DBuserName"))
	DBpassword=Trim(Request.Form("DBpassword"))
	DBpath=Trim(Request.Form("DBpath"))
	if DBtype="SQL" then
		if DBserverName="" then DBserverName="(local)"
		if DBdataName="" or DBuserName="" or DBpassword="" then
			Call rps_error("请将信息填写完整",2,"")
			Response.End()
		end if
		connStr="PROVIDER=SQLOLEDB; SERVER="& DBserverName &"; UID="& DBuserName &"; PWD="& DBpassword &"; DATABASE="& DBdataName &" "
	elseif DBtype="Access" then
		if DBpath="" then
			Call rps_error("请将信息填写完整",2,"")
			Response.End()
		end if
		connStr="Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & DBpath
	end if
	Set conn=server.CreateObject("ADODB.Connection")
		conn.connectionString=connStr
		conn.connectionTimeout=5
		conn.open 
        If Err Then
			Call rps_error("数据库连接出错\n\n"& Err.description,2,"")
            Err.Clear
            Set conn = Nothing
            On error goto 0
        End If
        On Error Goto 0
		response.Write("<script language=""javascript"" type=""text/javascript"">"&vbcrlf)
		response.Write("<!--"&vbcrlf)
		response.Write("var ArrTables=new Array();"&vbcrlf)
		Dim rsSchema, i : i=0	
		Dim Ra, j, fieldstr
		Set Ra=Server.CreateObject("Adodb.ReCordSet")	
		Set rsSchema=conn.openSchema(20) 
			rsSchema.movefirst 
			Do Until rsSchema.EOF 
				if rsSchema("TABLE_TYPE")="TABLE" then
					fieldstr=""
					Ra.open "Select * from ["& rsSchema("TABLE_NAME") &"]", conn, 0, 1
				 		For j=0 to Ra.fields.count-1 
							fieldstr=fieldstr &","& Ra.fields.item(j).name 
						Next
				 	Ra.close
					if left(fieldstr, 1)="," then fieldstr=Mid(fieldstr, 2)
					Response.write("ArrTables["& i &"]=new Array("""& rsSchema("TABLE_NAME") &""","""& fieldstr &""");"& vbcrlf)
					i=i+1
				end if 
				rsSchema.movenext 
			Loop 
		Set rsSchema=nothing
		Set Ra=nothing	
		response.Write("//-->"&vbcrlf)
		response.Write("</script>		"&vbcrlf)
End if
%>
<fieldset>
		<legend disabled>数据库设置</legend>
<table border="0" cellspacing="0" cellpadding="0" class="Form">
<form name="Save" method="post" action="index.asp" />
  <tr>
    <td width="40%" class="Formtitle" disabled>数据库类型:</td>
    <td class="FormValue"><label for="SQL"><input name="DBtype" type="radio" value="SQL" id="SQL" <%if DBtype="SQL" then response.Write("checked")%>  onclick="document.getElementById('SQLSet').style.display='';document.getElementById('AccessSet').style.display='none';"/>SQL</label>
	<label for="Access"><input name="DBtype" type="radio" value="Access" id="Access"  <%if DBtype="Access" then response.Write("checked")%>  onclick="document.getElementById('SQLSet').style.display='none';document.getElementById('AccessSet').style.display='';"/>Access</label>
	
	</td>
  </tr>
  <tbody id="SQLSet" <%if DBtype<>"SQL" then response.Write("style=""display:none;""")%>>
  <tr>
    <td class="Formtitle" disabled>服务器名称:</td>
    <td class="FormValue"><input type="text" name="DBserverName" value="<%=DBserverName%>" class="input" /></td>
  </tr>
  <tr>
    <td class="Formtitle" disabled>数据库名称:</td>
    <td><input type="text" name="DBdataName" value="<%=DBdataName%>" class="input"  /></td>
  </tr>
  <tr>
    <td class="Formtitle" disabled>登录用户名:</td>
    <td><input type="text" name="DBuserName" value="<%=DBuserName%>" class="input"  /></td>
  </tr>
  <tr>
    <td class="Formtitle" disabled>登录密码:</td>
    <td><input type="text" name="DBpassword" value="<%=DBpassword%>"  class="input" /></td>
  </tr>
  </tbody>
  <tbody id="AccessSet" <%if DBtype<>"Access" then response.Write("style=""display:none;""")%>>
  <tr>
    <td class="Formtitle" disabled>数据库路径:</td>
    <td><input type="file" name="DBpath" value="<%=DBpath%>"  class="input" /></td>
  </tr>
  </tbody>
  <tr>
    <td colspan="2" align="center"><input type="submit" value="提交" />
	&nbsp;&nbsp;<input type="reset" value="重置" /></td>
  </tr>
  </form>
</table>
</fieldset>

<%
if isobject(conn) then 
%>
<fieldset>
		<legend disabled>生成设置</legend>
<table border="0" cellspacing="0" cellpadding="0" class="Form">
<form name="MakeForm" >
  <tr>
    <td width="15%" class="Formtitle" disabled>表选择:</td>
    <td class="FormValue" id="TableList"></td>
  </tr>
  <tr>
    <td class="Formtitle" disabled>字段选择:</td>
    <td class="FormValue" id="FieldList" style="padding-top:5px; padding-bottom:5px;"></td>
  </tr>
  <tr>
    <td class="Formtitle" disabled>生成选项:</td>
    <td class="FormValue" style="padding-top:5px; padding-bottom:5px;">
	<label for="FormValue"><input type="checkbox" value="yes" name="FormValue" id="FormValue" onclick="changeItem(this, 'FormValueItem')" />处理表单值</label>
	<label for="GetTableValue"><input type="checkbox" value="yes" name="GetTableValue" id="GetTableValue" onclick="changeItem(this, 'GetTableValueItem')" />取得数据表值</label>
	<label for="AddTableValue"><input type="checkbox" value="yes" name="AddTableValue" id="AddTableValue" onclick="changeItem(this, 'AddTableValueItem')" />增加数据表值</label>
	<label for="GetForm"><input type="checkbox" value="yes" name="GetForm" id="GetForm" onclick="changeItem(this, 'GetFormItem')" />生成提交表单</label>
	<label><input type="button" value="提交" onclick="GetResult()"  />
	<input type="button" value="复制" onclick="copycode(Result)"  /></label>
	
	
	
	
	</td>
  </tr>
  <tr id="FormValueItem" style="display:none">
    <td class="Formtitle" disabled>处理表单值:</td>
    <td class="FormValue" style="padding-top:5px; padding-bottom:5px;">
	<span>前空格:<input type="text" name="FormValue_blank" id="FormValue_blank" style="width:50px;" /></span>
	<span>变量前缀:<input type="text" name="FormValue_frontprefix" id="FormValue_frontprefix" style="width:50px;" /></span>
	<span>域名前缀:<input type="text" name="FormValue_afterprefix" id="FormValue_afterprefix" style="width:50px;" /></span>
	<span>前代码:<input type="text" name="FormValue_frontCode" id="FormValue_frontCode" value="Trim(Request.Form(&quot;" style="width:150px;" /></span>
	<span>后代码:<input type="text" name="FormValue_afterCode" id="FormValue_afterCode" style="width:50px;" value="&quot;))" /></span>
  
  
	</td>
  </tr>
  
  
  <tr id="GetTableValueItem" style="display:none">
    <td class="Formtitle" disabled>取得数据表值:</td>
    <td class="FormValue" style="padding-top:5px; padding-bottom:5px;">
	<span>前空格:<input type="text" name="GetTableValue_blank" id="GetTableValue_blank" style="width:50px;" /></span>
	<span>Set对象:<input type="text" name="GetTableValue_Set" id="GetTableValue_Set" style="width:50px;" /></span>
	<span>变量前缀:<input type="text" name="GetTableValue_frontprefix" id="GetTableValue_frontprefix" style="width:50px;" /></span>
	<span><input type="radio" name="GetTableValue_SetType" id="GetTableValue_SetType1" checked="checked" />Execute</span>
	<span><input type="radio" name="GetTableValue_SetType" id="GetTableValue_SetType2" />RecordSet</span>
	</td>
  </tr>
  
  
  
  <tr id="AddTableValueItem" style="display:none">
    <td class="Formtitle" disabled>增加数据表值:</td>
    <td class="FormValue" style="padding-top:5px; padding-bottom:5px;">
	<span>前空格:<input type="text" name="AddTableValue_blank" id="AddTableValue_blank" style="width:50px;" /></span>
	<span>Set对象:<input type="text" name="AddTableValue_Set" id="AddTableValue_Set" style="width:50px;" /></span>
	<span>变量前缀:<input type="text" name="AddTableValue_frontprefix" id="AddTableValue_frontprefix" style="width:50px;" /></span>
	</td>
  </tr>
  
  <tr id="GetFormItem" style="display:none">
    <td class="Formtitle" disabled>生成提交表单:</td>
    <td class="FormValue" style="padding-top:5px; padding-bottom:5px;">
<span>前&#12288;空&#12288;格:<input type="text" name="GetForm_blank" id="GetForm_blank" style="width:50px;" /></span> 
<span>TR&nbsp;属&nbsp;性:<input type="text" name="GetForm_Tr" id="GetForm_Tr" style="width:50px;" /></span> 
<span>TD标题属性:<input type="text" name="GetForm_TdTitle" id="GetForm_TdTitle" style="width:50px;" /></span> 
<span>TD内容属性:<input type="text" name="GetForm_TdContent" id="GetForm_TdContent" style="width:50px;" /></span> 
<span>Input属性:<input type="text" name="GetForm_Input" id="GetForm_Input" style="width:50px;" /></span> 
<span>单行项数:<input type="text" name="GetForm_Num" id="GetForm_Num" style="width:25px;" value="1" onkeyup="if(isNaN(this.value)){this.value='';}" /></span> <br />
<span>表单域前缀:<input type="text" name="GetForm_frontprefix" id="GetForm_frontprefix" style="width:50px;" /></span>
<span>变量前缀:<input type="text" name="GetForm_Dimprefix" id="GetForm_Dimprefix" style="width:50px;" /></span>
<span>生成值:<input type="checkbox" name="GetForm_IsGetvalue" id="GetForm_IsGetvalue" checked="checked" /></span>
	</td>
  </tr>
  <tr>
    <td class="Formtitle" disabled>生成结果:</td>
    <td class="FormValue" style="padding-top:5px; padding-bottom:5px;">
  	<textarea name="Result" id="Result" style="width:98%; height:20px;" onpropertychange="this.style.posHeight=this.scrollHeight;"></textarea>
  
	</td>
  </tr>
</form>  
</table>
</fieldset>






<script language="javascript" type="text/javascript">
<!--
function GetResult(){
	var SpaceStr="	";
	var ResultStr="";
	var IsNochoice=true;
	var ObjForm=document.MakeForm;
	var ChoiceTables=ObjForm.Table;
	var ChoiceTable="";
	for(var i=0; i<ChoiceTables.length ;i++){
		if(ChoiceTables[i].checked) ChoiceTable=ChoiceTables[i].value;
	}
	
	if(ChoiceTable==""){
		alert("请进行表选择操作");
		return false;
	}
	
	var ArrField=new Array();
	var Fields=ObjForm.Field;
	var j=0, n=0;
	for(i=0; i<Fields.length; i++){
		if(Fields[i].checked){
			ArrField[j]=Fields[i].value;
			n=(ArrField[j].length>n)?ArrField[j].length:n;
			j++;
		}
	}
	if(j==0){
		alert("请进行字段选择操作");
		return false;
	}
	
	//==================================================================处理表单值
	if(document.getElementById("FormValue").checked){
		IsNochoice=false;
		var FormValue_blank=document.getElementById("FormValue_blank").value;
		var FormValue_frontprefix=document.getElementById("FormValue_frontprefix").value;
		var FormValue_afterprefix=document.getElementById("FormValue_afterprefix").value;
		var FormValue_frontCode=document.getElementById("FormValue_frontCode").value;
		var FormValue_afterCode=document.getElementById("FormValue_afterCode").value;
		var FormValue_DimStr=FormValue_blank +"Dim ";
		for(i=0; i<ArrField.length; i++){

⌨️ 快捷键说明

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