📄 sub.asp
字号:
<%' ---------------------副程序 -------------------------
' 此函数会将 recordset 栏位类型代码转换为易读的英文识别字
Function GetTypeString(TypeId)
Select Case TypeId
Case 0 GetTypeString = "Empty"
Case 16 GetTypeString = "TinyInt"
Case 2 GetTypeString = "SmallInt"
Case 3 GetTypeString = "Int"
Case 20 GetTypeString = "BigInt"
Case 17 GetTypeString = "UnsignedTinyInt"
Case 18 GetTypeString = "UnsignedSmallInt"
Case 19 GetTypeString = "UnsignedInt"
Case 21 GetTypeString = "UnsignedBigInt"
Case 4 GetTypeString = "Single"
Case 5 GetTypeString = "Double"
Case 6 GetTypeString = "Currency"
Case 14 GetTypeString = "Decimal"
Case 131 GetTypeString = "Numeric"
Case 11 GetTypeString = "Bit"
Case 10 GetTypeString = "Error"
Case 132 GetTypeString = "UserDefined"
Case 12 GetTypeString = "Variant"
Case 9 GetTypeString = "IDispatch"
Case 13 GetTypeString = "IUnknown"
Case 72 GetTypeString = "GUID"
Case 7 GetTypeString = "Date"
Case 133 GetTypeString = "DBDate"
Case 134 GetTypeString = "DBTime"
Case 135 GetTypeString = "Datetime"
Case 8 GetTypeString = "BSTR"
Case 129 GetTypeString = "Char"
Case 200 GetTypeString = "VarChar"
Case 201 GetTypeString = "LongVarChar"
Case 130 GetTypeString = "WChar"
Case 202 GetTypeString = "Text"
Case 203 GetTypeString = "Memo"
Case 128 GetTypeString = "Binary"
Case 204 GetTypeString = "VarBinary"
Case 205 GetTypeString = "LongVarBinary"
Case Else GetTypeString = "Unknown Type"
End Select
End Function
'由资料库中取得资料表的名称,并显示于HTML网页的列窗中
Sub SchemaToList(conn, tbl)
Dim Criteria
' 设定查询 Schema 的限制条件
Criteria = Array(Empty, Empty, Empty, "TABLE")
' 建立 HTML 的列示窗控件
Response.Write "<SELECT NAME='tbl'>"
' 以限制条件查询Schema,在正文中会进一步说明
Set rs = conn.OpenSchema(20, Criteria)
Do While Not rs.EOF
'将资料表名称加入列示窗控件中
Response.Write "<OPTION VALUE=" & rs("TABLE_NAME")
if rs("TABLE_NAME") = tbl then
Response.Write " selected"
end if
Response.Write ">" & rs("TABLE_NAME") & "</OPTION>"
rs.MoveNext
Loop
rs.Close
Response.Write "</SELECT>"
End Sub
' 显示资料表内容
Sub ShowRS1(rs)
js=0%>
<table border="0" width="100%" cellspacing="0" cellpadding="0">
<tr>
<td width="100%" >
<table border="1" width="100%" bordercolordark="#FFFFFF" cellspacing="0" bordercolor="#C0C0C0">
<tr>
<td valign="bottom" bgcolor="#C0C0C0" colspan="20"> <%=sql%>
</td></tr>
<tr>
<%for i=0 to rs.fields.count-1%>
<td align="center">
<%Response.Write rs(i).name & "/"
response.Write GetTypeString(rs(i).Type) %></td>
<%next%></tr>
<%do while not rs.eof %>
<tr><% for i=0 to rs.fields.count-1%><td align="center"><%=rs(i)%>
</td><%next
js=js+1%></tr><%rs.movenext
loop
rs.close
conn.close%>
<tr>
<td valign="bottom" bgcolor="#C0C0C0" colspan="20">
记录总数为:<%=js%>
</td>
</tr>
</table>
</td>
</tr>
</table>
<%End Sub
'处理’号出错问题
Function CheckChar(FValue)
CheckChar = Replace(FValue, "'", "' + Chr(39) + '")
End Function
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -