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

📄 tables_design.aspx

📁 ASP[1].NET在线SQL数据库企业管理器v0.13(C#源码提供),希望对大家有用
💻 ASPX
📖 第 1 页 / 共 2 页
字号:
						iLength = 16
						iPrecision = 0
					elseif lcase(Type_Name) = "nvarchar" then
						iLength = Length / 2
						iPrecision = Precision
					else 
						if IsDBNull(Length) then
							iLength = 0
						else
							iLength = Length
						end if
						if IsDBNull(Precision) then
							iPrecision = 0
						else
							iPrecision = Precision
						end if
					end if
					
					if lcase(cType_Name) = "text" or lcase(cType_Name) = "ntext" or lcase(cType_Name) = "image" then 
						ciLength = 16
						ciPrecision = 0
					elseif lcase(cType_Name) = "nvarchar" then
						ciLength = cLength / 2
						ciPrecision = cPrecision
					else 
						if IsDBNull(cLength) then
							ciLength = 0
						else
							ciLength = cLength
						end if
						if IsDBNull(cPrecision) then
							ciPrecision = 0
						else
							ciPrecision = cPrecision
						end if
					end if
				Else
					
					iLength = Length
					ciLength = cLength
					iPrecision = Precision
					ciPrecision = cPrecision
				End if
				
					
				.write ("<input type=""text"" size=""4"" name=""Length_" & Count & """ value=""" & iLength & """ class=""TableInput"">" & vbCRLF)
				.write ("<input type=""hidden"" size=""4"" name=""cLength_" & Count & """ value=""" & ciLength & """ class=""TableInput"">" & vbCRLF)
				.write ("</td>")
				
				.write ("<td class=""TableGrid"">")
				.write ("<input type=""text"" size=""5"" name=""Precision_" & Count & """ value=""" & iPrecision  & """ class=""TableInput"">" & vbCRLF)
				.write ("<input type=""hidden"" size=""5"" name=""cPrecision_" & Count & """ value=""" & ciPrecision  & """ class=""TableInput"">" & vbCRLF)
				.write ("</td>")
				
				.write ("<td class=""TableGrid"">")
				.write ("<input type=""text"" size=""5""  name=""Scale_" & Count & """ value=""" & iif(IsDBNull(Scale), 0 , Scale)  & """ class=""TableInput"">" & vbCRLF)
				.write ("<input type=""hidden"" size=""5""  name=""cScale_" & Count & """ value=""" & iif(IsDBNull(cScale), 0 , cScale)  & """ class=""TableInput"">" & vbCRLF)
				.write ("</td>")
				
				
				.write ("<td class=""TableGrid"" align=""center"">")
				.write ("<input type=""checkbox"" size=""5""  name=""Nulls_" & Count & """ " & iif(IS_NULLABLE = "on", " CHECKED " , "")  & ">" & vbCRLF)
				.write ("<input type=""hidden"" size=""5""  name=""cNulls_" & Count & """ value=""" & iif(cIS_NULLABLE = "on", " CHECKED " , "") & """>" & vbCRLF)
				.write ("</td>")
				
				.write ("<td class=""TableGrid"">")
				.write ("<input type=""text"" size=""20"" name=""Default_" & Count & """ value=""" & Column_Def & """ class=""TableInput"">" & vbCRLF)
				.write ("<input type=""hidden"" size=""20"" name=""cDefault_" & Count & """ value=""" & cColumn_Def & """ class=""TableInput"">" & vbCRLF)
				.write ("</td>")
				
				if InStr(Type_Name, "identity") <> 0 then
					.write ("<td class=""TableGrid"" align=""center"">")
					.write ("&nbsp;<input type=""checkbox"" name=""Identity_" & Count & """ size=""5"" CHECKED>" & vbCRLF)
					.write ("<input type=""hidden"" size=""5""  name=""cIdentity_" & Count & """ value=""on"">" & vbCRLF)
					.write ("</td>")
					.write ("<td class=""TableGrid"" align=""center"">")
					.write ("<input type=""text"" size=""3"" name=""Seed_" & Count & """ value=""" & IdentSeed  & """ class=""TableInput"">" & vbCRLF)
					.write ("<input type=""hidden"" size=""3"" name=""cSeed_" & Count & """ value=""" & cIdentSeed  & """ class=""TableInput"">" & vbCRLF)
					.write ("</td>")
					.write ("<td class=""TableGrid"" align=""center"">")
					.write ("<input type=""text"" size=""3""  name=""Increment_" & Count & """ value=""" & IdentIncr  & """ class=""TableInput"">" & vbCRLF)
					.write ("<input type=""hidden"" size=""3""  name=""cIncrement_" & Count & """ value=""" & cIdentIncr  & """ class=""TableInput"">" & vbCRLF)
					.write ("</td>")
				
				else
					.write ("<td class=""TableGrid"" align=""center"">")
					.write ("&nbsp;<input type=""checkbox"" name=""Identity_" & Count & """>" & vbCRLF)
					.write ("<input type=""hidden"" size=""5""  name=""cIdentity_" & Count & """ value="""">" & vbCRLF)
					.write ("</td>")
					.write ("<td class=""TableGrid"" align=""center"">")
					.write ("<input type=""text"" size=""3"" name=""Seed_" & Count & """ value="""" class=""TableInput"">" & vbCRLF)
					.write ("<input type=""hidden"" size=""3"" name=""cSeed_" & Count & """ value="""" class=""TableInput"">" & vbCRLF)
					.write ("</td>")
					.write ("<td class=""TableGrid"" align=""center"">")
					.write ("<input type=""text"" size=""3"" name=""Increment_" & Count & """ value="""" class=""TableInput"">" & vbCRLF)
					.write ("<input type=""hidden"" size=""3"" name=""cIncrement_" & Count & """ value="""" class=""TableInput"">" & vbCRLF)
					.write ("</td>")
				
				end if
				.write ("<td>")
				.write ("<a href=""javascript:document.forms['editForm'].elements['Insert'].value=" & Count & "; document.forms['editForm'].submit();"">")
				.write ("<img src=""images/navbar_button_insert.gif"" border=""0""></a>")
				
				.write("</tr>")
		
			End With
		
		End Sub

	
		Sub DrawTypeBox(typeStr as String, numStr as String)
			Dim d as new MLP.Data.Data
			Dim typedr as SqlDataReader
			dim type as String
			Typedr = d.getData("USE master Select distinct Type_Name from spt_datatype_info order by Type_Name ASC")
						
			With Response
				typeStr = replace(typeStr, "(", "")
				typeStr = replace(typeStr, ")", "")
				if instr(typeStr, " ") then
					type = Trim(Left(typeStr, Instr(TypeStr, " ")))
				else
					type = typeStr
				end if
				.write ("<select onChange=""SetFields (this, 1);"" name=""Type_" & numStr & """ class=""TableInput"">")
				While typeDR.Read()		
					if InStr(typedr("Type_Name"), "identity") = 0 then
						.write ("<option ")
						if type = typedr("Type_Name") then response.write (" SELECTED ")
						.write (">" & typedr("Type_Name") & "</option>" & vbCRLF)
					end if
				End While
				.write ("</select>")
				.write ("<input type=""hidden"" name=""cType_" & numStr & """ value=""" & type & """>")
					
			End With
			typeDR = nothing
		End Sub

</script>




<center>
<br>
<table cellspacing="0" class="TableStyle">
<tr><td class="WindowHeader">
	<% DrawTitle("Design Table...", "javascript:history.back()") %>
</td></tr>
<tr><td class="TableHeader">
	<table cellpadding="10">
	<tr><td>



<%

	dim Count as Integer = 0


	With Response
		.write ("<form action=""tables_design.aspx"" name=""editForm"" method=""POST"">" & vbCRLF)
		.write ("<input type=""hidden"" name=""Save"" value=""Save"">" & vbCRLF)
		.write ("<input type=""hidden"" name=""Insert"" value="""">" & vbCRLF)
		.write ("<Input type=""hidden"" name=""table"" value=""" & table & """>" & vbCRLF)
		
		.write ("<table class=""MainStyle""  cellspacing=""0"" cellpadding=""2"">")
		
		.write ("<tr><td>")
		%>		
				<table class="MainStyle" width="100%">
					<tr><td valign="bottom" width="26">
						<img src="images/small_icons_tables.gif">
					</td><td NOWRAP> 
						<%
							if table <> "" then								
								.write ("<B>Table Name: <input type=""text"" name=""newTable"" value=""" & table & """ class=""TableInput"">")
							else
								.write ("<B>Table Name: <input type=""text"" name=""newTable"" value=""NewTable"" class=""TableInput"">")
							end if
						%>
	 				</td><td>
	 				
	 					<input type="text" name="AddFields"  size="5">
	 					<input type="submit" value="Add Fields">
	 				
	 				
	 				</td><td align="right">
	 					<input type="submit" value="save">
	 				</td></tr>
	 				</table>
		<%
		
		
		.write ("</td></tr>")
		.write ("<tr><Td>")
		.write ("<br>")
		
		.write ("<table class=""TableStyle"" cellspacing=""0"" cellpadding=""0"">")
		.write ("<tr><td class=""TableHeader"">")
		.write ("Key")
		.write ("</td><td class=""TableHeader"" width=""150"">")
		.write ("Name")
		.write ("</td><td class=""TableHeader"">")
		.write ("Type")
		.write ("</td><td class=""TableHeader"">")
		.write ("&nbsp;Length")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Precision")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Scale")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Nulls")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Default Value")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Ident")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Seed")
		.write ("</td>")
		.write ("<td class=""TableHeader"">")
		.write ("Incr.")
		.write ("</td><td class=""TableHeader"">")
		.write ("&nbsp;</td></tr>" & vbCRLF)
		
		
		
			if table <> "" and InsertPoint = "" and Request("AddFields") = ""  then
					' Get the Primary Keys
					dr = d.getDataSPA("sp_pkeys '" & request("Table") & "'")
					Dim PrimaryKeys as String = ""
					While dr.read()
						PrimaryKeys = PrimaryKeys & "*" & dr("COLUMN_NAME") & "*"
					End While 
			
			
					dim dr2 as SQLDataReader
					dim IdentSeed as Integer
					dim IdentIncr as Integer
					dr = d.getDataSPA("SP_Columns '" & table & "'")
					
					dr2 = d.getData("Select Ident_Incr('" & table & "') as IDENT_INCR, IDENT_SEED('" & table & "') as IDENT_SEED from " _
						& " INFORMATION_SCHEMA.TABLES Where TABLE_NAME='" & table & "'")
					
					if dr2.read() then
						IdentSeed = iif(IsDBNull(dr2("Ident_Seed")), -1, dr2("Ident_Seed"))
						IdentIncr = iif(IsDBNull(dr2("Ident_Incr")), -1, dr2("Ident_Incr"))
					end if
					
					dr2 = nothing
			
					Dim Key as String
					while dr.read()
							Count = Count + 1
							Key = iif(Instr(PrimaryKeys, dr("Column_Name")) = 0, "", "on")
							
							DrawRow (Count, dr("column_Name"), dr("Type_Name"), dr("Length"), dr("Precision"), dr("Scale"), iif(dr("Is_Nullable") = "YES", "on", ""), _
							 		dr("Column_Def"), IdentSeed, IdentIncr, dr("column_Name"), dr("Type_Name"), dr("Length"), dr("Precision"), dr("Scale"), iif(dr("Is_Nullable") = "YES", "on", ""), _
							 		dr("Column_Def"), IdentSeed, IdentIncr, Key, Key, 1)
							
					End While
			
			else
				dim X as Integer
				dim type as String
				
				Dim FieldCount as Integer 
				Dim AddFields as Integer = iif(Request("AddFields")="", 0, Request("AddFields")) 
				
				if Request("FieldCount") = "" then 
					FieldCount = 5
				else
					FieldCount = request("FieldCount")
				end if
				
				
				
				Count = 0
				For x = 1 to FieldCount + AddFields
				
					Count = Count + 1
					if request("Identity_" & X) <> "" then
						type = request("Type_" & X) & " identity"
					else
						type = request("Type_" & X)
					end if
				
					if InsertPoint = x.ToString then
								DrawRow (Count, "", "", 0, 0, 0, "", "", "" , "", "", "", 0, 0, 0, "", "", "" , "", "", "", 0)
								Count = Count + 1
					end if
								
					
					DrawRow (Count, request("Name_" & X), Type , request("Length_" & X), request("Precision_" & X), request("Scale_" & X), _
						iif(request("Nulls_" & X)<>"", "on", ""), request("Default_" & X), request("Seed_" & X), request("Increment_" & X), _
						request("cName_" & X), Type , request("cLength_" & X), request("cPrecision_" & X), request("cScale_" & X), _
						iif(request("cNulls_" & X)<>"", "on", ""), request("cDefault_" & X), request("cSeed_" & X), request("cIncrement_" & X), _
						request("Key_" & X), request("cKey_" & x),  0)
				
				Next
				
				Count = X
					
					
			End if			
		
		.write ("<tr><Td colspan=""11"">")
		.write ("<br>")
		.write ("</td></tr>")
		
		.write ("</table>")
		.write ("</td></tr>")
		.write ("</table>")
		
		.write ("<tr><td>")
		
		.write ("<input type=""hidden"" name=""FieldCount"" value=""" & Count & """>")		
		.write ("</form>")
		
		.write ("</td></tr>")
		.write ("</table>")
		
		
	End With
	
%>

<script language="javascript">

	for(x=1; x <= <%= Count %>; x++) {
		
		// document.write (document.forms("editForm").elements("Name_" + x).value)
		
		SetFields (document.forms("editForm").elements("Type_" + x), 0);
	
	}


</script>
	
	
</td></tr>
</table>

</td></tr>
</table>

</center>


<!--#include file="includes/bottom.aspx"-->	

⌨️ 快捷键说明

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