Note: You must be registered in order to post a reply. To register, click here. Registration is FREE! Before posting, make sure you have read this topic!
T O P I C R E V I E W
Carefree
Posted - 30 April 2015 : 01:05:26 I wrote this mod for Access, may need some tweaking for other database systems. It's like a miniature "PHPMyAdmin" program. Please let me know if you encounter an error. The mod will allow forum administrators to:
List all tables within your forum's database.
View all fields and field definitions (including auto-increment and "null allowed") within each table.
Create tables.
Drop tables.
Add Fields.
Drop fields.
Edit field definitions.
List all records within any table.
Add records.
Delete records. *
Edit records.*
Note:* - To edit/delete records using this application, tables must have auto-increment fields, so I put in a check and link if one doesn't exist.
I discovered that it would display hidden and system tables, so I modified the code to prevent that, they shouldn't be changed arbitrarily.
Update: I added the ability to filter and sort records. I also added the ability to create tables, so forum admins can do just about any database function from here. If someone wants to take this and make a comparable version for MySQL and/or SQL Server, have fun.
There are no database changes necessary to install. To add to the admin console:
"admin_home.asp"
Look for the following line (appx 142):
if strEmailVal = "1" then Response.Write(" <LI><span class=""spnMessageText""><a href=""admin_accounts_pending.asp"">Members Pending</a></span> <font size=""" & strFooterFontSize & """>(" & User_Count & ")</font></LI>" & vbNewLine)
Below it, insert these:
' ## DBase Editor Below
Response.Write " <LI><span class=""spnMessageText""><a href=""admin_db_defs.asp"">DBase Editor</a></span></LI>" & vbNewLine & _
' ## DBase Editor Above
"admin_db_defs.asp"
<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-14 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
If (Session(strCookieURL & "Approval") <> "15916941253") Or (MemberID <> intAdminMemberID) Then
scriptname = Split(Request.ServerVariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(UBound(scriptname)) & "?" & Request.ServerVariables("Query_String")
End If
Response.Write "<center><table border=""0"" width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolder,"","align=""absmiddle""") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","align=""absmiddle""") & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & "<a href=""admin_db_defs.asp"">Database Definitions</a><br /></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"<br />" & vbNewLine & _
" <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
" function ChangePage(fnum){" & vbNewLine & _
" document.PageNum2.submit();" & vbNewLine & _
" }" & vbNewLine & _
" </script>" & vbNewLine
Set adoxConn = CreateObject("ADOX.Catalog")
Set adodbConn = Server.CreateObject("ADODB.Connection")
adodbConn.Open(strConnString)
adoxConn.ActiveConnection = adodbConn
If Request("page") > "" Then
If IsNumeric(Request("page")) Then
mypage = CLng(Request("page"))
Else
mypage = 0
End If
Else
mypage = 0
End If
Dim cedit, ncname, tedit, tname, pathway
If Request("cplus") > "" Then
strSql = "ALTER TABLE " & Request("tname") & " ADD COLUMN " & Request("cplus") & " " & Request("ctype")
If Request("ctype") = "Varchar" Then strSql = strSql & " (" & Request("csize") & ")"
If Request("cnull") = "Yes" or Request("cnull") = "1" Then
strSql = strSql & " NULL"
Else
strSql = strSql & " NOT NULL"
End If
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
End If
If Request("cedit") > "" Then
If Request("doit") > "" Then
intAI = 0
For Each Column in Table.Columns
If Column.Properties("AutoIncrement") Then
intAI = 1
Exit For
End If
Next
If Request("ctype") = "AutoIncrement" And intAI = 1 Then
Response.Write "Table already has an AutoIncrement field, cannot make requested change. First modify existing AutoIncrement field." & _
"<meta http-equiv=""Refresh"" content=""2;URL=admin_db_defs.asp"" />" & vbNewLine
WriteFooter
Response.End
End If
strSql = "ALTER TABLE " & Request("tname") & " ALTER COLUMN " & Request("cedit") & " " & Request("ctype")
If Request("ctype") = "Varchar" Then strSql = strSql & " (" & Request("csize") & ") "
If Request("cnull") = "Yes" Or Request("cnull") = "1" Then
strSql = strSql & " NULL"
Else
strSql = strSql & " NOT NULL"
End If
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
End If
IsThere = "False"
For Each Table in adoxConn.Tables
If LCase(Table.Name) = LCase(Request("tname")) Then
IsThere = "True"
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tname"" value=""" & Request("tname") & """ />" & vbNewLine & _
" <input type=""hidden"" name=""cedit"" value=""" & Request("cedit") & """ />" & vbNewLine & _
" <input type=""hidden"" name=""doit"" value=""doit"" />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """ colspan=""4"">" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Definitions</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Type</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Size</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Allow Null</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
intI = 0
For Each Column in Table.Columns
If Column.Name = Request("cedit") Then
intCT = Column.Type
cType = "OLEObject"
If intCT = 2 Then cType = "Small Int"
If intCT = 3 Then cType = "Long Int"
If intCT = 4 Then cType = "Single"
If intCT = 5 Then cType = "Double"
If intCT = 6 Then cType = "Currency"
If intCT = 7 Then cType = "Date"
If intCT = 17 Then cType = "Byte"
If intCT = 72 Then cType = "Replica"
If intCT = 130 Then cType = "Char"
If intCT = 131 Then cType = "Numeric"
If intCT = 202 Then cType = "Varchar"
If intCT = 203 Then cType = "Memo"
If intCT = 204 Then cType = "Attachment"
If Column.DefinedSize = 0 Then
csize = 1
Else
csize = Column.DefinedSize
End If
If cType = "Memo" Then cSize = 65535
If Column.Properties("Nullable") Then
cnull="1"
Else
cnull="0"
End If
If Column.Properties("AutoIncrement") Then
cType = "Auto-Increment"
cnull="0"
End If
Response.Write " <tr bgColor = """ & strForumCellColor & """>" & vbNewLine & _
" <td>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>" & vbNewLine & _
" <input type=""text"" name=""ncname"" value=""" & Request("cedit") & """ style=""background:lightgrey; align:center; font-weight:bold; text-color:maroon; width:98%;"" />" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>" & vbNewLine & _
" <select name=""ctype"">" & vbNewLine & _
" <option style=""width:98%; background:lightblue; color:navy; font-weight:bold;"" value=""Choose Type"" selected>Choose Type</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Attachment"">Attachment</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""AutoIncrement"">AutoIncrement</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Byte"">Byte</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Char"">Char</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Currency"">Currency</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Date"">Date</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Double"">Double</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Long"">Long Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Memo"">Memo</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Numeric"">Numeric</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Replica"">Replica</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Single"">Single</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Short"">Small Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Varchar"">Varchar</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"">" & vbNewLine & _
" <input name=""csize"" value=""" & csize & """ style=""background-color:lightgrey; text-align:center; font-weight:bold; color:maroon; width:98%;"" /></td>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" Yes:<input type=""radio"" class=""radio"" style=""background:lightgrey;"" name=""cnull"" value=""1""" & chkRadio(cnull,0,false) & "> No:<input type=""radio"" class=""radio"" style=""background:lightgrey;"" name=""cnull"" value=""0""" & chkRadio(cnull,0,true) & ">" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Fielded"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>" & vbNewLine
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Exit For
End If
Next
End If
Next
End If
If Request("rdelete") > "" Then
strSV = Request.ServerVariables("Query_String")
For I = 1 to Len(strSV)
If Mid(strSV,I,1) = "&" Then
Exit For
End If
Next
For j = i to Len(strSV)
If Mid(strSV,j,1)="=" Then
strCol=Mid(strSV,I+1,j-i-1)
Exit For
End If
Next
strSql = "DELETE * FROM " & Request("rdelete") & " WHERE " & strCol & " = " & Request(strCol)
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
End If
If Request("addme")="doit" Then
strVal = ""
strSql = "INSERT INTO " & Request("table") & " ("
For Each Table in adoxConn.Tables
If Table.Name = Request("table") Then
For Each Column in Table.Columns
If Not Column.Properties("AutoIncrement") Then
strSql = strSql & Column.Name & ", "
If Column.Type <> 202 And Column.Type <> 203 Then
strVal = strVal & Request(Column.Name)
Else
strVal = strVal & "'" & Request(Column.Name) & "', "
End If
End If
Next
Exit For
End If
Next
strSql = Left(strSql, Len(strSql)-2) & ") VALUES (" & Left(strVal, Len(strVal)-2) & ")"
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("mode")="add" Then
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""mode"" value=""add"" />" & vbNewLine & _
" <input type=""hidden"" name=""addme"" value=""doit"" />" & vbNewLine & _
" <input type=""hidden"" name=""table"" value=""" & Request("tview") & """ />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""100"" bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Add Record</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strHeadCellColor & """>"
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
For Each Column in Table.Columns
If Not Column.Properties("AutoIncrement") Then
Response.Write "<td align=""center""><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>" & Column.Name & "</b></font></td>"
End If
Next
Response.Write "</tr><tr bgColor=""" & strForumCellColor & """>"
For Each Column in Table.Columns
intCT = Column.Type
strType = "OLEObject"
If intCT = 2 Then strType = "Small Int"
If intCT = 3 Then strType = "Long Int"
If intCT = 4 Then strType = "Single"
If intCT = 5 Then strType = "Double"
If intCT = 6 Then strType = "Currency"
If intCT = 7 Then strType = "Date"
If intCT = 17 Then strType = "Byte"
If intCT = 72 Then strType = "Replica"
If intCT = 130 Then strType = "Char"
If intCT = 131 Then strType = "Numeric"
If intCT = 202 Then strType = "Varchar"
If intCT = 203 Then strType = "Memo"
If intCT = 204 Then strType = "Attachment"
If Column.DefinedSize = 0 Then
intCS = 1
Else
intCS = Column.DefinedSize
End If
If strType = "Memo" Then intCS = 65535
If Not Column.Properties("AutoIncrement") Then
Response.Write "<td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine
If strType = "Memo" Then
Response.Write "<textarea name=""" & Column.Name & """ rows=10 style=""width:98%; font-weight:bold; color:maroon; background:lightgrey;"">" & Request(Column.Name) & "</textarea>"
ElseIf Not Column.Properties("AutoIncrement") Then
Response.Write "<input type=""text"" style=""text-align:"
If strType="Varchar" Then
Response.Write "left; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size=""30"" value=""" & Request(Column.Name) & """ />"
Else
Response.Write "center; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size="""& intCS+2 & """ value=""" & Request(Column.Name) & """ />"
End If
End If
Response.Write "</font></td>"
End If
Next
Response.Write "</tr>"
End If
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Submit"" value=""Submit"" /> <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Reset"" class=""button2"" name=""Reset"" value=""Reset"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine &_
"</form><br />" & vbNewLine
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("doit") > "" Then
strSql = "UPDATE " & Request("tname") & " SET "
For Each Table in adoxConn.Tables
If Table.Name = Request("tname") Then
For Each Column in Table.Columns
strOD = Trim(ChkString(Request("OD_" & Column.Name),"SQLString"))
strOC = Trim(ChkString(Request(Column.Name),"SQLString"))
If strOC <> strOD Then
If Not Column.Properties("AutoIncrement") Then
strSql = strSql & Column.Name & "="
If Column.Type = 202 Or Column.Type = 203 Then
strSql = strSql & "'" & strOC & "'"
Else
strSql = strSql & "" & strOC & ""
End If
strSql = strSql & ", "
End If
End If
Next
strSql = Left(strSql, Len(strSql)-2)
strSql = strSql & " WHERE " & Request("field") & "=" & Request("record")
Exit For
End If
Next
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
Response.Redirect "admin_db_defs.asp"
End If
If Request("redit") > "" Then
strSV = Request.ServerVariables("Query_String")
For I = 1 to Len(strSV)
If Mid(strSV,I,1) = "&" Then
Exit For
End If
Next
For j = i to Len(strSV)
If Mid(strSV,j,1)="=" Then
strCol=Mid(strSV,I+1,j-i-1)
Exit For
End If
Next
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tname"" value=""" & Request("redit") & """ />" & vbNewLine & _
" <input type=""hidden"" name=""doit"" value=""doit"" />" & vbNewLine & _
" <input type=""hidden"" name=""field"" value=""" & strCol & """ />" & vbNewLine & _
" <input type=""hidden"" name=""record"" value=""" & Request(strCol) & """ />" & vbNewLine & _
" <table width=""100%"" align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""100"" bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Record Viewer</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strHeadCellColor & """>"
For Each Table in adoxConn.Tables
If Table.Name = Request("redit") Then
For Each Column in Table.Columns
Response.Write "<td><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>" & Column.Name & "</b></font></td>"
Next
Response.Write "</tr><tr bgColor=""" & strForumCellColor & """>"
strSql = "SELECT * FROM " & Request("redit")
Set rsEdit = my_Conn.Execute(strSql)
If Not rsEdit.EOF Then
For Each Column in Table.Columns
strOD = "OD_" & Column.Name
rValue=rsEdit(Column.Name)
intCT = Column.Type
strType = "OLEObject"
If intCT = 2 Then strType = "Small Int"
If intCT = 3 Then strType = "Long Int"
If intCT = 4 Then strType = "Single"
If intCT = 5 Then strType = "Double"
If intCT = 6 Then strType = "Currency"
If intCT = 7 Then strType = "Date"
If intCT = 17 Then strType = "Byte"
If intCT = 72 Then strType = "Replica"
If intCT = 130 Then strType = "Char"
If intCT = 131 Then strType = "Numeric"
If intCT = 202 Then strType = "Varchar"
If intCT = 203 Then strType = "Memo"
If intCT = 204 Then strType = "Attachment"
If Column.DefinedSize = 0 Then
intCS = 1
Else
intCS = Column.DefinedSize
End If
If strType = "Memo" Then intCS = 65535
Response.Write "<td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
"<input type=""hidden"" name=" & strOD &" value=""" & rValue & """ />" & vbNewLine
If strType = "Memo" Then
Response.Write "<textarea name=""" & Column.Name & """ rows=10 columns=40 style=""width:98%; font-weight:bold; color:maroon; background:lightgrey;"">" & rsEdit(Column.Name) & "</textarea>"
ElseIf Not Column.Properties("AutoIncrement") Then
Response.Write "<input type=""text"" style=""text-align:"
If strType="Varchar" Then
Response.Write "left; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size=""30"" value=""" & rsEdit(Column.Name) & """ />"
Else
Response.Write "center; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size="""& intCS+2 & """ value=""" & rsEdit(Column.Name) & """ />"
End If
Else
Response.Write rsEdit(Column.Name)
End If
Response.Write "</font></td>"
Next
Response.Write "</tr>"
Else
Response.Write "<td align=""center"" colspan=""100""><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>No records found.</td></tr>" & vbNewLine
End If
End If
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Submit"" value=""Submit"" /> <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Reset"" class=""button2"" name=""Reset"" value=""Reset"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine &_
"</form><br />" & vbNewLine
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("tview") > "" Then
strPathway = "admin_db_defs.asp?tview=" & Request("tview")
If Request("page") > "" Then strPathway = strPathway & "&page=" & Request("page")
Response.Write "<form action=""admin_db_defs.asp?" & Request.ServerVariables("Query_String")&""" method=""post"">" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" cellpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1><a href=""" & strPathway & """>" & Request("tview") & "</a></h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""100"" bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Record Filter</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strForumCellColor & """>" & vbNewLine & _
" <td nowrap align=""right"" width=""30%"">" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>Filter Column: <select name=""filter"">"
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
For Each Column in Table.Columns
intTC = intTC +1
Next
For Each Column in Table.Columns
Response.Write " <option value=""" & Column.Name &""""
If Request("filter") = Column.Name Then Response.Write " SELECTED"
Response.Write ">" & Column.Name & "</option>"
Next
Exit For
End If
Next
If Request("operator")>"" Then strOperator=Request("operator")
Response.Write " </select>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""30%"">" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <select name=""operator"">" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""="""&ChkSelect(strOperator,"=")&">EQ</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""<"""&ChkSelect(strOperator,"<")&">LT</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""<="""&ChkSelect(strOperator,"<=")&">LE</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="">"""&ChkSelect(strOperator,">")&">GT</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""=>"""&ChkSelect(strOperator,"=>")&">GE</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""<>"""&ChkSelect(strOperator,"<>")&">UE</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""LIKE"""&ChkSelect(strOperator,"LIKE")&">Like</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""40%"">" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input style=""width:98%; color:maroon; background:lightgrey;"" type=""text"" name=""condition"" value=""" & Request("condition") & """ /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" colspan=""" & intCS+1&""">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""submit"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form><br />" & vbNewLine & _
"<table align=""center"" border=""0"" cellspacing=""0"" cellpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""" & intTC+1 & """ bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Record Viewer</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strHeadCellColor & """>"
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
intTC = 0
For Each Column in Table.Columns
intTC=intTC+1
Next
strColVal = ""
For Each Column in Table.Columns
If Column.Properties("AutoIncrement") Then strColVal = Column.Name
If Request("fld")=Column.Name Then
strOrd = Request("so")
If strOrd = "ASC" Then strFlip = "DESC" Else strFlip = "ASC"
Else
strFlip = "ASC"
End If
Response.Write "<td align=""center""><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b><a style=""color:" & strHeadFontColor & "; text-decoration:none;"" href=""admin_db_defs.asp?tview="&Table.Name&"&fld=" & Column.Name & "&so="&strFlip&""">" & Column.Name & "</b></font></td>"
Next
Response.Write " <td bgColor=""" & strHeadCellColor & """ align=""absmiddle"" nowrap><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b><a style=""text-decoration:none;"" href=""admin_db_defs.asp?mode=add&tview="&Request("tview")&"""><input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Button"" class=""button2"" name=""submit"" value=""New"" /></a></b></td></tr>"
If strColVal = "" Then
Response.Write "<tr bgColor=""" & strForumCellColor & """><td colspan=""" & intTC+1 & """ align=""center""><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>No key column (auto-increment) exists. To edit/delete records using this program, you must first create one. Click <a href=""admin_db_defs.asp?tb=" & Table.Name&""">here</a> to add the auto-increment field.</font></td></tr>"
End If
If strOrd > "" Then strSort=" ORDER BY " & Request("fld") & " " & strOrd Else strSort=""
If Request("filter") > "" Then
strWhere = " WHERE " & Request("filter")
If Column.Type(Request("filter")) = 202 Or Column.Type(Request("filter")) = 203 Then
If strOperator = "LIKE" Then
strCond = " LIKE '%" & Request("condition") & "%'"
Else
strCond = strOperator & "'" & Request("condition") & "'"
End If
Else
strCond = strOperator & Request("condition")
End If
strWhere = strWhere & Replace(strCond, " SELECTED","")
Else
strWhere=""
End If
strSql = "SELECT * FROM " & Table.Name & strSort & strWhere
Set rs = my_Conn.Execute(strSql)
If Not rs.EOF Then
rs.Move(mypage*25)
intI = 0
intQ = 0
Do While Not rs.EOF
intQ = intQ + 1
If intQ = 26 Then Exit Do
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write "<tr>"
For Each Column in Table.Columns
Response.Write "<td bgColor=""" & CColor & """><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & rs(Column.Name) & "</font></td>"
Next
strPath="admin_db_defs.asp?rdelete=" & Table.Name&"&" & strColVal & "=" & rs(strColVal)
Response.Write " <td bgColor=""" & CColor & """ nowrap align=""absmiddle""><a href=""admin_db_defs.asp?redit=" & Table.Name&"&" & strColVal & "=" & rs(strColVal)&"""" & dWStatus("edit") & "><acronym style=""border:none; text-decoration:none"" title=""Edit""><img src="""& strImageURL &"icon_pencil.gif"" height=""16"" width=""16"" alt=""Edit"" style=""border:none; text-decoration:none;""></acronym></a> <a href=""admin_db_defs.asp?rdelete=" & Table.Name&"&" & strColVal & "=" & rs(strColVal) & """" & dWStatus("Delete") & "><acronym style=""border:none; text-decoration:none"" title=""Delete""><img src="""& strImageURL &"icon_trashcan.gif"" height=""16"" width=""16"" alt=""Delete"" style=""border:none; text-decoration:none;""></acronym></a></td></tr>" & vbNewLine
rs.MoveNext
intI = 1 - intI
Loop
rs.Close
Else
Response.Write "<tr><td align=""center"" colspan=""100"" bgColor=""" & strForumCellColor & """><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>No Records Found</font></td></tr>"
End If
Set rs = Nothing
Response.Write " </table>" & vbNewLine
End If
Next
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
strSql = "SELECT COUNT("
For Each Column in Table.Columns
strSql = strSql & Column.Name
Exit For
Next
strSql = strSql & ") AS CNT FROM " & Table.Name
strSql = strSql & strWhere
Set rsTC = my_Conn.Execute(strSql)
If Not rsTC.EOF Then
intCount = rsTC("CNT")
rsTC.Close
End If
Set rsTC = Nothing
intTotalPages = CInt(intCount / 25)
End If
Next
If intTotalPages > 1 Then
Call DropDownPaging(2)
End If
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("tedit") > "" Then
If Request("tname") > "" Then
strED=Request("tedit"):strND=Request("tname")
adoxConn.Tables(strED).Name = strND
adoxConn.Close
Set adoxConn = Nothing
Set adodbConn = Nothing
Response.Redirect "admin_db_defs.asp"
Response.End
Else
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tedit"" value=""" & Request("tedit") & """ />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & Request("tedit") & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """ colspan=""2"">" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Table Edit</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""right"" width=""30%"" bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><b>Rename: </b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""tname"" value=""" & Request("tname") & """ style=""background:lightgrey; align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""top"">" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""submit"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>"
End If
WriteFooter
Response.End
ElseIf Request("tdelete") > "" Then
strSql = "DROP TABLE " & Request("tdelete")
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
Response.End
ElseIf Request("cdelete") > "" Then
strSql = "ALTER TABLE " & Request("tname") & " DROP COLUMN " & Request("cdelete")
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
Response.End
End If
If Request("tmake") = "doit" Then
strSql = "CREATE TABLE " & ChkString(Request("tname"),"SQLString") & " ("
For I = 1 to 10
If Request("ftype"&CStr(i)) = "AutoIncrement" Then
strSql = strSql & ChkString(Request("fname"&CStr(i)), "SQLString") & " COUNTER NOT NULL, "
Exit For
End If
Next
For I = 1 to 10
If Trim(Request("fname"&CStr(I))) > "" Then
If Request("ftype"&CStr(i)) <> "AutoIncrement" Then
strSql = strSql & ChkString(Request("fname"&CStr(i)),"SQLString")
If Request("fnull"&CStr(I)) = 0 Then strNull = "NOT NULL" Else strNull = "NULL"
If Request("ftype"&CStr(i)) = "Varchar" Then
strSql = strSql & " VARCHAR(" & Request("fsize"&CStr(I)) & ") " & strNull
Else
strSql = strSql & " " & Request("ftype"&CStr(I)) & " " & strNull
End If
strSql = strSql & ", "
End If
End If
Next
strSql = Left(strSql,Len(strSql)-2) & ")"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Response.Redirect "admin_db_defs.asp"
End If
If Request("mode")="tmake" Then ' Create Table form
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tmake"" value=""doit"" />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>Create Table</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" colspan=""4"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Table Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""right"" width=""50%"" bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><b>Name: </b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""50%"" bgcolor=""" & strForumCellColor & """ colspan=""3"">" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""tname"" value=""" & Request("tname") & """ style=""background:lightgrey; align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td nowrap align=""center"" width=""50%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td nowrap align=""center"" width=""10%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Size</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td nowrap align=""center"" width=""30%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Type</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td nowrap align=""center"" width=""10%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Null Allowed</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
For i = 1 to 10
If i/2 = CInt(i/2) Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write " <tr>" & vbNewLine & _
" <td align=""center"" width=""50%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""fname"&cStr(i)&""" value=""" & Request("fname" & cStr(i)) & """ style=""background:" & CColor & ";"" align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""10%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""fsize"&cStr(i)&""" value=""" & Request("fsize" & cStr(i)) & """ style=""background:" & CColor & ";"" align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""40%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <select name=""ftype"&cStr(i)&""">" & vbNewLine & _
" <option style=""width:98%; background:lightblue; color:navy; font-weight:bold;"" value=""Choose Type"" selected>Choose Type</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Attachment"">Attachment</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""AutoIncrement"">AutoIncrement</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Byte"">Byte</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Char"">Char</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Currency"">Currency</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Date"">Date</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Double"">Double</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Long"">Long Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Memo"">Memo</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Numeric"">Numeric</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Replica"">Replica</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Single"">Single</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Short"">Small Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Varchar"">Varchar</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""10%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" Yes:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""fnull"&CStr(I)&""" value=""1""" & chkRadio(Request("fnull"&CStr(I)),0,false) & """ /> No:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""fnull"&CStr(I)&""" value=""0""" & chkRadio(Request("fnull"&CStr(I)),0,true) & """ /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""top"">" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""submit"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>"
WriteFooter
Response.End
End If
If Request("tb") > "" Then
ColType Request("tb")
Else
Response.Write "<table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Table Names</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <a style=""text-decoration:none;"" href=""admin_db_defs.asp?mode=tmake""><input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Button"" class=""button2"" name=""submit"" value=""New"" /></a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
For Each Table in adoxConn.Tables
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
If Table.Type = "TABLE" Then
Response.Write " <tr bgColor = """ & CColor & """>" & vbNewLine & _
" <td>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """><a href=""admin_db_defs.asp?tb=" & Table.Name & """>"&Table.Name&"</a></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td>" & vbNewLine & _
" <a href=""admin_db_defs.asp?tedit=" & Table.Name & """" & dWStatus("Rename") & "><acronym style=""border:none; text-decoration:none"" title=""Rename""><img src="""& strImageURL &"icon_pencil.gif"" height=""16"" width=""16"" alt=""Rename"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" <a href=""admin_db_defs.asp?tview=" & Table.Name & """" & dWStatus("View") & "><acronym style=""border:none; text-decoration:none"" title=""View""><img src="""& strImageURL &"icon_binoc.png"" height=""16"" width=""16"" alt=""View"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" <a href=""admin_db_defs.asp?tdelete=" & Table.Name & """" & dWStatus("Delete") & "><acronym style=""border:none; text-decoration:none"" title=""Delete""><img src="""& strImageURL &"icon_trashcan.gif"" height=""16"" width=""16"" alt=""Delete"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>"
intI = 1 - intI
End If
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>"
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
End If
WriteFooter
Function chkSelect(actualValue, thisValue)
If IsNumeric(actualValue) Then actualValue = cLng(actualValue)
If actualValue = thisValue Then
chkSelect = " SELECTED"
Else
chkSelect = ""
End If
End Function
Function ColType(strTable)
For Each Table in adoxConn.Tables
If LCase(Table.Name) = LCase(strTable) Then
IsThere = "True"
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""cedit"" value=""" & LCase(Table.Name) & """ />" & vbNewLine & _
" <input type=""hidden"" name=""tname"" value=""" & Table.Name & """ />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """ colspan=""5"">" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Definitions</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Type</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Size</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Allow Null</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """> " & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
intI = 0
For Each Column in Table.Columns
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write " <tr bgColor = """ & CColor & """>" & vbNewLine & _
" <td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>"&Column.Name&"</font></td>" & vbNewLine & _
" <td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>"
intCT = Column.Type
strType = "OLEObject"
If intCT = 2 Then strType = "Small Int"
If intCT = 3 Then strType = "Long Int"
If intCT = 4 Then strType = "Single"
If intCT = 5 Then strType = "Double"
If intCT = 6 Then strType = "Currency"
If intCT = 7 Then strType = "Date"
If intCT = 17 Then strType = "Byte"
If intCT = 72 Then strType = "Replica"
If intCT = 130 Then strType = "Char"
If intCT = 131 Then strType = "Numeric"
If intCT = 202 Then strType = "Varchar"
If intCT = 203 Then strType = "Memo"
If intCT = 204 Then strType = "Attachment"
If Column.DefinedSize = 0 Then
intCS = 1
Else
intCS = Column.DefinedSize
End If
If strType = "Memo" Then intCS = 65535
If Column.Properties("Nullable") Then
strN="<b>N</b> "
Else
strN = "<font color=""" & strHiLiteFontColor & """><b><s>N</s></b> </font>"
End If
If Column.Properties("AutoIncrement") Then
strType = "AutoIncrement"
strN = "<font color=""" & strHiLiteFontColor & """><b><s>N</s></b> </font>"
End If
Response.Write strType & " </font></td>" & vbNewLine & _
" <td align=right><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>"&intCS&"</font></td>" & vbNewLine & _
" <td align=center>" & strN & "</td>" & vbNewLine & _
" <td align=absmiddle>" & vbNewLine & _
" <a href=""admin_db_defs.asp?cedit=" & Column.Name & "&tname=" & Table.Name &"""" & dWStatus("Edit") & "><acronym style=""border:none; text-decoration:none"" title=""Edit""><img src="""& strImageURL &"icon_pencil.gif"" height=""16"" width=""16"" alt=""Edit"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" <a href=""admin_db_defs.asp?cdelete=" & Column.Name & "&tname=" & Table.Name &"""" & dWStatus("Delete") & "><acronym style=""border:none; text-decoration:none"" title=""Delete""><img src="""& strImageURL &"icon_trashcan.gif"" height=""16"" width=""16"" alt=""Delete"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr />"
intI = 1 - intI
Next
End If
Next
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write " <tr bgColor=""" & CColor & """>" & vbNewLine & _
" <td align=""center""><input type=""text"" name=""cplus"" value=""" & Request("cplus") & """ style=""background-color:" & CColor & "; text-align:center; font-weight:bold; color:maroon; width:98%;"" /></td>" & vbNewLine & _
" <td align=""left"">" & vbNewLine & _
" <select name=""ctype"">" & vbNewLine & _
" <option style=""width:98%; background:lightblue; color:navy; font-weight:bold;"" value=""Choose Type"" selected>Choose Type</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Attachment"">Attachment</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""AutoIncrement"">AutoIncrement</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Byte"">Byte</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Char"">Char</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Currency"">Currency</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Date"">Date</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Double"">Double</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Long"">Long Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Memo"">Memo</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Numeric"">Numeric</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Replica"">Replica</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Single"">Single</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Short"">Small Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Varchar"">Varchar</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"">" & vbNewLine & _
" <input name=""csize"" value=""" & Request("csize") & """ style=""background:" & CColor & "; text-align:center; font-weight:bold; color:maroon; width:98%;"" /></td>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" Yes:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""cnull"" value=""1""" & chkRadio(cnull,0,false) & "> No:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""cnull"" value=""0""" & chkRadio(cnull,0,true) & ">" & vbNewLine & _
" </td>" & vbNewLine & _
" <td>" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration:none; border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Fielded"" value=""Add Field"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr />" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>" & vbNewLine & _
"<p align=center><a href=""admin_db_defs.asp"">Back to Tables</a></p>"
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
End Function
Sub DropDownPaging(fnum)
If intTotalPages > 1 Then
Response.Write "<form name=""PageNum"&fnum & """ action=""admin_db_defs.asp"" >" & vbNewLine & _
" <input type=""hidden"" name=""tview"" value=""" & Request("tview") & """ />" & vbNewLine & _
" <table align=""right"" cellpadding=""0"" cellspacing=""0"" border=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td nowrap align=""right"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <select name=""page"" onchange=""this.form.submit();"">" & vbNewLine
For PgCnt = 1 To intTotalPages
Response.Write "<option value=""" & PgCnt & """"
If PgCnt = mypage Then
Response.Write " selected"
End If
Response.Write ">" & PgCnt & "</option>" & vbNewLine
Next
Response.Write " </select> of <b>" & intTotalPages & "</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>"
End If
End Sub
%>
Here's an UNTESTED version to hopefully support MySQL & SQL Server. Don't use this on a live database, create a test database.
<%
'#################################################################################
'## Snitz Forums 2000 v3.4.07
'#################################################################################
'## Copyright (C) 2000-14 Michael Anderson, Pierre Gorissen,
'## Huw Reddick and Richard Kinser
'##
'## This program is free software; you can redistribute it and/or
'## modify it under the terms of the GNU General Public License
'## as published by the Free Software Foundation; either version 2
'## of the License, or (at your option) any later version.
'##
'## All copyright notices regarding Snitz Forums 2000
'## must remain intact in the scripts and in the outputted HTML
'## The "powered by" text/logo with a link back to
'## http://forum.snitz.com in the footer of the pages MUST
'## remain visible when the pages are viewed on the internet or intranet.
'##
'## This program is distributed in the hope that it will be useful,
'## but WITHOUT ANY WARRANTY; without even the implied warranty of
'## MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
'## GNU General Public License for more details.
'##
'## You should have received a copy of the GNU General Public License
'## along with this program; if not, write to the Free Software
'## Foundation, Inc., 59 Temple Place - Suite 330, Boston, MA 02111-1307, USA.
'##
'## Support can be obtained from our support forums at:
'## http://forum.snitz.com
'##
'## Correspondence and Marketing Questions can be sent to:
'## manderson@snitz.com
'##
'#################################################################################
%>
<!--#INCLUDE FILE="config.asp"-->
<!--#INCLUDE FILE="inc_sha256.asp" -->
<!--#INCLUDE FILE="inc_header.asp" -->
<%
if Session(strCookieURL & "Approval") <> "15916941253" then
scriptname = split(Request.ServerVariables("SCRIPT_NAME"),"/")
Response.Redirect "admin_login.asp?target=" & scriptname(ubound(scriptname)) & "?" & Request.ServerVariables("Query_String")
end if
Response.Write "<center><table border=""0"" width=""100%"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td width=""33%"" align=""left"" nowrap><font face=""" & strDefaultFontFace & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" " & getCurrentIcon(strIconFolder,"","align=""absmiddle""") & " <a href=""admin_home.asp"">Admin Section</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpen,"","align=""absmiddle""") & " <a href=""default.asp"">All Forums</a><br />" & vbNewLine & _
" " & getCurrentIcon(strIconBlank,"","align=""absmiddle""") & getCurrentIcon(strIconBar,"","align=""absmiddle""") & getCurrentIcon(strIconFolderOpenTopic,"","align=""absmiddle""") & "<a href=""admin_db_defs.asp"">Database Definitions</a><br /></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>" & vbNewLine & _
"<br />" & vbNewLine
Response.Write " <script language=""JavaScript"" type=""text/javascript"">" & vbNewLine & _
" function ChangePage(fnum){" & vbNewLine & _
" document.PageNum2.submit();" & vbNewLine & _
" }" & vbNewLine & _
" </script>" & vbNewLine
Set adoxConn = CreateObject("ADOX.Catalog")
Set adodbConn = Server.CreateObject("ADODB.Connection")
adodbConn.Open(strConnString)
adoxConn.activeConnection = adodbConn
If Request("page") > "" Then
If IsNumeric(Request("page")) Then
mypage = CLng(Request("page"))
Else
mypage = 0
End If
Else
mypage = 0
End If
Dim cedit, ncname, tedit, tname, pathway
If Request("cplus") > "" Then
strSql = "ALTER TABLE " & Request("tname") & " ADD COLUMN " & Request("cplus") & " " & Request("ctype")
If Request("ctype") = "Varchar" Then strSql = strSql & " (" & Request("csize") & ")"
If Request("cnull") = "Yes" or Request("cnull") = "1" Then
strSql = strSql & " NULL"
Else
strSql = strSql & " NOT NULL"
End If
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
End If
If Request("cedit") > "" Then
If Request("doit") > "" Then
intAI = 0
For Each Column in Table.Columns
If Column.Properties("AutoIncrement") Then
intAI = 1
Exit For
End If
Next
If Request("ctype") = "AutoIncrement" And intAI = 1 Then
Response.Write "Table already has an AutoIncrement field, cannot make requested change. First modify existing AutoIncrement field." & _
"<meta http-equiv=""Refresh"" content=""2;URL=admin_db_defs.asp"" />" & vbNewLine
WriteFooter
Response.End
End If
strSql = "ALTER TABLE " & Request("tname") & " ALTER COLUMN " & Request("cedit") & " " & Request("ctype")
If Request("ctype") = "Varchar" Then strSql = strSql & " (" & Request("csize") & ") "
If Request("cnull") = "Yes" or Request("cnull") = "1" Then
strSql = strSql & " NULL"
Else
strSql = strSql & " NOT NULL"
End If
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
End If
IsThere = "False"
For Each Table in adoxConn.Tables
If LCase(Table.Name) = LCase(Request("tname")) Then
IsThere = "True"
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tname"" value=""" & Request("tname") & """ />" & vbNewLine & _
" <input type=""hidden"" name=""cedit"" value=""" & Request("cedit") & """ />" & vbNewLine & _
" <input type=""hidden"" name=""doit"" value=""doit"" />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """ colspan=""4"">" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Definitions</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Type</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Size</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Allow Null</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
intI = 0
For Each Column in Table.Columns
If Column.Name = Request("cedit") Then
If strDBType = "access" Then
intCT = Column.Type
ElseIf strDBType = "mysql" Then
strSql = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE.NAME= '" & TABLE.NAME & "' AND COLUMN.NAME = '" & COLUMN.NAME & "'"
adoxConn.Execute(strSql)
intCT = adoxConn("DATA_TYPE")
End If
cType = "OLEObject"
If intCT = 2 Then cType = "Small Int"
If intCT = 3 Then cType = "Long Int"
If intCT = 4 Then cType = "Single"
If intCT = 5 Then cType = "Double"
If intCT = 6 Then cType = "Currency"
If intCT = 7 Then cType = "Date"
If intCT = 17 Then cType = "Byte"
If intCT = 72 Then cType = "Replica"
If intCT = 130 Then cType = "Char"
If intCT = 131 Then cType = "Numeric"
If intCT = 202 Then cType = "Varchar"
If intCT = 203 Then cType = "Memo"
If intCT = 204 Then cType = "Attachment"
If Column.DefinedSize = 0 Then
csize = 1
Else
csize = Column.DefinedSize
End If
If cType = "Memo" Then cSize = 65535
If Column.Properties("Nullable") Then
cnull="1"
Else
cnull="0"
End If
If Column.Properties("AutoIncrement") Then
cType = "Auto-Increment"
cnull="0"
End If
Response.Write " <tr bgColor = """ & strForumCellColor & """>" & vbNewLine & _
" <td>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>" & vbNewLine & _
" <input type=""text"" name=""ncname"" value=""" & Request("cedit") & """ style=""background:lightgrey; align:center; font-weight:bold; text-color:maroon; width:98%;"" />" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>" & vbNewLine & _
" <select name=""ctype"">" & vbNewLine & _
" <option style=""width:98%; background:lightblue; color:navy; font-weight:bold;"" value=""Choose Type"" selected>Choose Type</option>" & vbNewLine
If strDBType <> "sqlserver" Then
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "OLEObject" Else Response.Write "BLOB"
Response.Write """>Attachment</option>" & vbNewLine
End If
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""AutoIncrement"">AutoIncrement</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Byte"">Byte</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Char"">Char</option>" & vbNewLine
If stDBType <> "mysql" Then
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Currency" Else Response.Write "Money"
Response.Write """>Currency</option>" & vbNewLine
End If
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Date/Time" Else Response.Write "DateTime"
Response.Write """>Date/Time</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Double" ElseIf strDBType="mysql" Then Response.Write "SmallInt(2)" Else Response.Write "SmallInt"
Response.Write """>Double</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Long" Else Response.Write "BigInt"
Response.Write """>Long Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Memo" Else Response.Write "Text"
Response.Write """>Memo</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Single" ElseIf strDBType="mysql" Then Response.Write "TinyInt(1)" Else Response.Write "TinyInt"
Response.Write """>Single</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Short" Else Response.Write "Int"
Response.Write """>Small Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""VarChar"">VarChar</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"">" & vbNewLine & _
" <input name=""csize"" value=""" & csize & """ style=""background-color:lightgrey; text-align:center; font-weight:bold; color:maroon; width:98%;"" /></td>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" Yes:<input type=""radio"" class=""radio"" style=""background:lightgrey;"" name=""cnull"" value=""1""" & chkRadio(cnull,0,false) & "> No:<input type=""radio"" class=""radio"" style=""background:lightgrey;"" name=""cnull"" value=""0""" & chkRadio(cnull,0,true) & ">" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Fielded"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>" & vbNewLine
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Exit For
End If
Next
End If
Next
End If
If Request("rdelete") > "" Then
strSV = Request.ServerVariables("Query_String")
For I = 1 to Len(strSV)
If Mid(strSV,I,1) = "&" Then
Exit For
End If
Next
For j = i to Len(strSV)
If Mid(strSV,j,1)="=" Then
strCol=Mid(strSV,I+1,j-i-1)
Exit For
End If
Next
strSql = "DELETE * FROM " & Request("rdelete") & " WHERE " & strCol & " = " & Request(strCol)
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
End If
If Request("addme")="doit" Then
strVal = ""
strSql = "INSERT INTO " & Request("table") & " ("
For Each Table in adoxConn.Tables
If Table.Name = Request("table") Then
For Each Column in Table.Columns
If Not Column.Properties("AutoIncrement") Then
strSql = strSql & Column.Name & ", "
If Column.Type <> 202 And Column.Type <> 203 Then
strVal = strVal & Request(Column.Name)
Else
strVal = strVal & "'" & Request(Column.Name) & "', "
End If
End If
Next
Exit For
End If
Next
strSql = Left(strSql, Len(strSql)-2) & ") VALUES (" & Left(strVal, Len(strVal)-2) & ")"
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("mode")="add" Then
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""mode"" value=""add"" />" & vbNewLine & _
" <input type=""hidden"" name=""addme"" value=""doit"" />" & vbNewLine & _
" <input type=""hidden"" name=""table"" value=""" & Request("tview") & """ />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""100"" bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Add Record</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strHeadCellColor & """>"
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
For Each Column in Table.Columns
If Not Column.Properties("AutoIncrement") Then
Response.Write "<td align=""center""><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>" & Column.Name & "</b></font></td>"
End If
Next
Response.Write "</tr><tr bgColor=""" & strForumCellColor & """>"
For Each Column in Table.Columns
If strDBType = "access" Then
intCT = Column.Type
ElseIf strDBType = "mysql" Then
strSql = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE.NAME= '" & TABLE.NAME & "' AND COLUMN.NAME = '" & COLUMN.NAME & "'"
adoxConn.Execute(strSql)
intCT = adoxConn("DATA_TYPE")
End If
strType = "OLEObject"
If intCT = 2 Then strType = "Small Int"
If intCT = 3 Then strType = "Long Int"
If intCT = 4 Then strType = "Single"
If intCT = 5 Then strType = "Double"
If intCT = 6 Then strType = "Currency"
If intCT = 7 Then strType = "Date"
If intCT = 17 Then strType = "Byte"
If intCT = 72 Then strType = "Replica"
If intCT = 130 Then strType = "Char"
If intCT = 131 Then strType = "Numeric"
If intCT = 202 Then strType = "Varchar"
If intCT = 203 Then strType = "Memo"
If intCT = 204 Then strType = "Attachment"
If Column.DefinedSize = 0 Then
intCS = 1
Else
intCS = Column.DefinedSize
End If
If strType = "Memo" Then intCS = 65535
If Not Column.Properties("AutoIncrement") Then
Response.Write "<td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine
If strType = "Memo" Then
Response.Write "<textarea name=""" & Column.Name & """ rows=10 style=""width:98%; font-weight:bold; color:maroon; background:lightgrey;"">" & Request(Column.Name) & "</textarea>"
ElseIf Not Column.Properties("AutoIncrement") Then
Response.Write "<input type=""text"" style=""text-align:"
If strType="Varchar" Then
Response.Write "left; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size=""30"" value=""" & Request(Column.Name) & """ />"
Else
Response.Write "center; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size="""& intCS+2 & """ value=""" & Request(Column.Name) & """ />"
End If
End If
Response.Write "</font></td>"
End If
Next
Response.Write "</tr>"
End If
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Submit"" value=""Submit"" /> <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Reset"" class=""button2"" name=""Reset"" value=""Reset"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine &_
"</form><br />" & vbNewLine
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("doit") > "" Then
strSql = "UPDATE " & Request("tname") & " SET "
For Each Table in adoxConn.Tables
If Table.Name = Request("tname") Then
For Each Column in Table.Columns
strOD = Trim(ChkString(Request("OD_" & Column.Name),"SQLString"))
strOC = Trim(ChkString(Request(Column.Name),"SQLString"))
If strOC <> strOD Then
If Not Column.Properties("AutoIncrement") Then
strSql = strSql & Column.Name & "="
If Column.Type = 202 Or Column.Type = 203 Then
strSql = strSql & "'" & strOC & "'"
Else
strSql = strSql & "" & strOC & ""
End If
strSql = strSql & ", "
End If
End If
Next
strSql = Left(strSql, Len(strSql)-2)
strSql = strSql & " WHERE " & Request("field") & "=" & Request("record")
Exit For
End If
Next
Response.Wriite strSql
Response.End
my_Conn.Execute(strSql),,adCmdText + adExecuteNoRecords
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
Response.Redirect "admin_db_defs.asp"
End If
If Request("redit") > "" Then
strSV = Request.ServerVariables("Query_String")
For I = 1 to Len(strSV)
If Mid(strSV,I,1) = "&" Then
Exit For
End If
Next
For j = i to Len(strSV)
If Mid(strSV,j,1)="=" Then
strCol=Mid(strSV,I+1,j-i-1)
Exit For
End If
Next
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tname"" value=""" & Request("redit") & """ />" & vbNewLine & _
" <input type=""hidden"" name=""doit"" value=""doit"" />" & vbNewLine & _
" <input type=""hidden"" name=""field"" value=""" & strCol & """ />" & vbNewLine & _
" <input type=""hidden"" name=""record"" value=""" & Request(strCol) & """ />" & vbNewLine & _
" <table width=""100%"" align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""100"" bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Record Viewer</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strHeadCellColor & """>"
For Each Table in adoxConn.Tables
If Table.Name = Request("redit") Then
For Each Column in Table.Columns
Response.Write "<td align=""center""><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>" & Column.Name & "</b></font></td>"
Next
Response.Write "</tr><tr bgColor=""" & strForumCellColor & """>"
strSql = "SELECT * FROM " & Request("redit")
Set rsEdit = my_Conn.Execute(strSql)
If Not rsEdit.EOF Then
For Each Column in Table.Columns
strOD = "OD_" & Column.Name
rValue=rsEdit(Column.Name)
Response.Write "<input type=""hidden"" name=" & strOD &" value=" & rValue & " />" & vbNewLine
If strDBType = "access" Then
intCT = Column.Type
ElseIf strDBType = "mysql" Then
strSql = "SELECT DATA_TYPE FROM INFORMATION_SCHEMA.COLUMNS WHERE TABLE.NAME= '" & TABLE.NAME & "' AND COLUMN.NAME = '" & COLUMN.NAME & "'"
adoxConn.Execute(strSql)
intCT = adoxConn("DATA_TYPE")
End If
strType = "OLEObject"
If intCT = 2 Then strType = "Small Int"
If intCT = 3 Then strType = "Long Int"
If intCT = 4 Then strType = "Single"
If intCT = 5 Then strType = "Double"
If intCT = 6 Then strType = "Currency"
If intCT = 7 Then strType = "Date"
If intCT = 17 Then strType = "Byte"
If intCT = 72 Then strType = "Replica"
If intCT = 130 Then strType = "Char"
If intCT = 131 Then strType = "Numeric"
If intCT = 202 Then strType = "Varchar"
If intCT = 203 Then strType = "Memo"
If intCT = 204 Then strType = "Attachment"
If Column.DefinedSize = 0 Then
intCS = 1
Else
intCS = Column.DefinedSize
End If
If strType = "Memo" Then intCS = 65535
Response.Write "<td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine
If strType = "Memo" Then
Response.Write "<textarea name=""" & Column.Name & """ rows=10 style=""width:98%; font-weight:bold; color:maroon; background:lightgrey;"">" & rsEdit(Column.Name) & "</textarea>"
ElseIf Not Column.Properties("AutoIncrement") Then
Response.Write "<input type=""text"" style=""text-align:"
If strType="Varchar" Then
Response.Write "left; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size=""30"" value=""" & rsEdit(Column.Name) & """ />"
Else
Response.Write "center; color:maroon; font-weight:bold; background:lightgrey;"" name=""" & Column.Name & """ maxlength=""" & intCS & """ size="""& intCS+2 & """ value=""" & rsEdit(Column.Name) & """ />"
End If
Else
Response.Write rsEdit(Column.Name)
End If
Response.Write "</font></td>"
Next
Response.Write "</tr>"
End If
End If
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Submit"" value=""Submit"" /> <input style=""color:" & strHeadFontColor & "; font-weight:bold; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Reset"" class=""button2"" name=""Reset"" value=""Reset"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine &_
"</form><br />" & vbNewLine
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("tview") > "" Then
strPathway = "admin_db_defs.asp?tview=" & Request("tview")
If Request("page") > "" Then strPathway = strPathway & "&page=" & Request("page")
Response.Write "<table align=""center"" border=""0"" cellspacing=""0"" cellpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1><a href=""" & strPathway & """>" & Request("tview") & "</a></h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td colspan=""100"" bgColor=""" & strCategoryCellColor & """ align=""center""><font size=""" & strHeaderFontSize+1 & """ color=""" & strCategoryFontColor & """><b>Record Viewer</b></font></td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr bgColor=""" & strHeadCellColor & """>"
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
For Each Column in Table.Columns
If Column.Properties("AutoIncrement") Then strColVal = Column.Name
Response.Write "<td align=""center""><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>" & Column.Name & "</b></font></td>"
Next
Response.Write "<td align=""absmiddle"" nowrap><font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b><a style=""text-decoration:none;"" href=""admin_db_defs.asp?mode=add&tview="&Request("tview")&"""><input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Button"" class=""button2"" name=""submit"" value=""New"" /></a></b></td></tr>"
strSql = "SELECT * FROM " & Table.Name
Set rs = my_Conn.Execute(strSql)
If Not rs.EOF Then
rs.Move(mypage*25)
intI = 0
intQ = 0
Do While Not rs.EOF
intQ = intQ + 1
If intQ = 26 Then Exit Do
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write "<tr>"
For Each Column in Table.Columns
Response.Write "<td bgColor=""" & CColor & """><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & rs(Column.Name) & "</font></td>"
Next
strPath="admin_db_defs.asp?rdelete=" & Table.Name&"&" & strColVal & "=" & rs(strColVal)
Response.Write " <td bgColor=""" & CColor & """ nowrap align=""absmiddle""><a href=""admin_db_defs.asp?redit=" & Table.Name&"&" & strColVal & "=" & rs(strColVal)&"""" & dWStatus("edit") & "><acronym style=""border:none; text-decoration:none"" title=""Edit""><img src="""& strImageURL &"icon_pencil.gif"" height=""16"" width=""16"" alt=""Edit"" style=""border:none; text-decoration:none;""></acronym></a> <a href=""admin_db_defs.asp?rdelete=" & Table.Name&"&" & strColVal & "=" & rs(strColVal) & """" & dWStatus("Delete") & "><acronym style=""border:none; text-decoration:none"" title=""Delete""><img src="""& strImageURL &"icon_trashcan.gif"" height=""16"" width=""16"" alt=""Delete"" style=""border:none; text-decoration:none;""></acronym></a></td></tr>" & vbNewLine
rs.MoveNext
intI = 1 - intI
Loop
rs.Close
End If
Set rs = Nothing
Response.Write " </table>" & vbNewLine
End If
Next
For Each Table in adoxConn.Tables
If Table.Name = Request("tview") Then
strSql = "SELECT COUNT("
For Each Column in Table.Columns
strSql = strSql & Column.Name
Exit For
Next
strSql = strSql & ") AS CNT FROM " & Table.Name
Set rsTC = my_Conn.Execute(strSql)
If Not rsTC.EOF Then
intCount = rsTC("CNT")
rsTC.Close
End If
Set rsTC = Nothing
intTotalPages = CInt(intCount / 25)
End If
Next
If intTotalPages > 1 Then
Call DropDownPaging(2)
end if
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
WriteFooter
Response.End
End If
If Request("tedit") > "" Then
If Request("tname") > "" Then
strED=Request("tedit"):strND=Request("tname")
adoxConn.Tables(strED).Name = strND
adoxConn.Close
Set adoxConn = Nothing
Set adodbConn = Nothing
Response.Redirect "admin_db_defs.asp"
Response.End
Else
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tedit"" value=""" & Request("tedit") & """ />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & Request("tedit") & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """ colspan=""2"">" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Table Edit</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""right"" width=""30%"" bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><b>Rename: </b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""tname"" value=""" & Request("tname") & """ style=""background:lightgrey; align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""top"">" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""submit"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>"
End If
WriteFooter
Response.End
ElseIf Request("tdelete") > "" Then
strSql = "DROP TABLE " & Request("tdelete")
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
Response.End
ElseIf Request("cdelete") > "" Then
strSql = "ALTER TABLE " & Request("tname") & " DROP COLUMN " & Request("cdelete")
my_Conn.Execute(strSql)
Response.Redirect "admin_db_defs.asp"
Response.End
End If
If Request("tmake") = "doit" Then
strSql = "CREATE TABLE " & ChkString(Request("tname"),"SQLString") & " ("
For I = 1 to 10
If Request("ftype"&CStr(i)) = "AutoIncrement" Then
strSql = strSql & ChkString(Request("fname"&CStr(i)), "SQLString") & " COUNTER NOT NULL, "
Exit For
End If
Next
For I = 1 to 10
If Trim(Request("fname"&CStr(I))) > "" Then
If Request("ftype"&CStr(i)) <> "AutoIncrement" Then
strSql = strSql & ChkString(Request("fname"&CStr(i)),"SQLString")
If Request("fnull"&CStr(I)) = 0 Then strNull = "NOT NULL" Else strNull = "NULL"
If Request("ftype"&CStr(i)) = "Varchar" Then
strSql = strSql & " VARCHAR(" & Request("fsize"&CStr(I)) & ") " & strNull
Else
strSql = strSql & " " & Request("ftype"&CStr(I)) & " " & strNull
End If
strSql = strSql & ", "
End If
End If
Next
strSql = Left(strSql,Len(strSql)-2) & ")"
my_Conn.Execute (strSql),,adCmdText + adExecuteNoRecords
Response.Redirect "admin_db_defs.asp"
End If
If Request("mode")="tmake" Then ' Create Table form
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""tmake"" value=""doit"" />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>Create Table</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" colspan=""4"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Table Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""right"" width=""50%"" bgcolor=""" & strForumCellColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><b>Name: </b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"" width=""50%"" bgcolor=""" & strForumCellColor & """ colspan=""3"">" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""tname"" value=""" & Request("tname") & """ style=""background:lightgrey; align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td nowrap align=""center"" width=""50%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td nowrap align=""center"" width=""10%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Size</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td nowrap align=""center"" width=""30%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Type</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td nowrap align=""center"" width=""10%"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Null Allowed</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
For i = 1 to 10
If i/2 = CInt(i/2) Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write " <tr>" & vbNewLine & _
" <td align=""center"" width=""50%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""fname"&cStr(i)&""" value=""" & Request("fname" & cStr(i)) & """ style=""background:" & CColor & ";"" align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""10%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """><input type=""text"" name=""fsize"&cStr(i)&""" value=""" & Request("fsize" & cStr(i)) & """ style=""background:" & CColor & ";"" align:center; font-weight:bold; color:maroon; width:98%;"" /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""40%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <select name=""ftype"&cStr(i)&""">" & vbNewLine & _
" <option style=""width:98%; background:lightblue; color:navy; font-weight:bold;"" value=""Choose Type"" selected>Choose Type</option>" & vbNewLine
If strDBType <> "sqlserver" Then
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "OLEObject" Else Response.Write "BLOB"
Response.Write """>Attachment</option>" & vbNewLine
End If
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""AutoIncrement"">AutoIncrement</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Byte"">Byte</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Char"">Char</option>" & vbNewLine
If stDBType <> "mysql" Then
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Currency" Else Response.Write "Money"
Response.Write """>Currency</option>" & vbNewLine
End If
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Date/Time" Else Response.Write "DateTime"
Response.Write """>Date/Time</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Double" ElseIf strDBType="mysql" Then Response.Write "SmallInt(2)" Else Response.Write "SmallInt"
Response.Write """>Double</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Long" Else Response.Write "BigInt"
Response.Write """>Long Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Memo" Else Response.Write "Text"
Response.Write """>Memo</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Single" ElseIf strDBType="mysql" Then Response.Write "TinyInt(1)" Else Response.Write "TinyInt"
Response.Write """>Single</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Short" Else Response.Write "Int"
Response.Write """>Small Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""VarChar"">VarChar</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" width=""10%"" bgcolor=""" & CColor & """>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" Yes:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""fnull"&CStr(I)&""" value=""1""" & chkRadio(Request("fnull"&CStr(I)),0,false) & """ /> No:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""fnull"&CStr(I)&""" value=""0""" & chkRadio(Request("fnull"&CStr(I)),0,true) & """ /></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr valign=""top"">" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""submit"" value=""Submit"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>"
WriteFooter
Response.End
End If
If Request("tb") > "" Then
ColType Request("tb")
Else
Response.Write "<table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Table Names</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """>" & vbNewLine & _
" <a style=""text-decoration:none;"" href=""admin_db_defs.asp?mode=tmake""><input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Button"" class=""button2"" name=""submit"" value=""New"" /></a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
For Each Table in adoxConn.Tables
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
If Table.Type = "TABLE" Then
Response.Write " <tr bgColor = """ & CColor & """>" & vbNewLine & _
" <td>" & vbNewLine & _
" <font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """><a href=""admin_db_defs.asp?tb=" & Table.Name & """>"&Table.Name&"</a></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td>" & vbNewLine & _
" <a href=""admin_db_defs.asp?tedit=" & Table.Name & """" & dWStatus("Rename") & "><acronym style=""border:none; text-decoration:none"" title=""Rename""><img src="""& strImageURL &"icon_pencil.gif"" height=""16"" width=""16"" alt=""Rename"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" <a href=""admin_db_defs.asp?tview=" & Table.Name & """" & dWStatus("View") & "><acronym style=""border:none; text-decoration:none"" title=""View""><img src="""& strImageURL &"icon_binoc.png"" height=""16"" width=""16"" alt=""View"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" <a href=""admin_db_defs.asp?tdelete=" & Table.Name & """" & dWStatus("Delete") & "><acronym style=""border:none; text-decoration:none"" title=""Delete""><img src="""& strImageURL &"icon_trashcan.gif"" height=""16"" width=""16"" alt=""Delete"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>"
intI = 1 - intI
End If
Next
Response.Write " </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
"</table>"
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
End If
WriteFooter
Function ColType(strTable)
For Each Table in adoxConn.Tables
If LCase(Table.Name) = LCase(strTable) Then
IsThere = "True"
Response.Write "<form action=""admin_db_defs.asp"" method=""post"">" & vbNewLine & _
" <input type=""hidden"" name=""cedit"" value=""" & LCase(Table.Name) & """ />" & vbNewLine & _
" <input type=""hidden"" name=""tname"" value=""" & Table.Name & """ />" & vbNewLine & _
" <table align=""center"" border=""0"" cellspacing=""0"" celllpadding=""0"" />" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center""><h1>" & strTable & "</h1>" & vbNewLine & _
" <table width=""100%"" border=""1"" style=""border-collapse:collapse;"" cellspacing=""1"" cellpadding=""4"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strCategoryCellColor & """ colspan=""5"">" & vbNewLine & _
" <font color=""" & strCategoryFontColor & """ size=""" & strHeaderFontSize+1 & """><b>Field Definitions</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Name</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Type</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Size</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """>" & vbNewLine & _
" <font color=""" & strHeadFontColor & """ size=""" & strHeaderFontSize & """><b>Allow Null</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"" bgcolor=""" & strHeadCellColor & """> " & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine
intI = 0
For Each Column in Table.Columns
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write " <tr bgColor = """ & CColor & """>" & vbNewLine & _
" <td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>"&Column.Name&"</font></td>" & vbNewLine & _
" <td><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>"
intCT = Column.Type
strType = "OLEObject"
If intCT = 2 Then strType = "Small Int"
If intCT = 3 Then strType = "Long Int"
If intCT = 4 Then strType = "Single"
If intCT = 5 Then strType = "Double"
If intCT = 6 Then strType = "Currency"
If intCT = 7 Then strType = "Date"
If intCT = 17 Then strType = "Byte"
If intCT = 72 Then strType = "Replica"
If intCT = 130 Then strType = "Char"
If intCT = 131 Then strType = "Numeric"
If intCT = 202 Then strType = "Varchar"
If intCT = 203 Then strType = "Memo"
If intCT = 204 Then strType = "Attachment"
If Column.DefinedSize = 0 Then
intCS = 1
Else
intCS = Column.DefinedSize
End If
If strType = "Memo" Then intCS = 65535
If Column.Properties("Nullable") Then
strN="<b>N</b> "
Else
strN = "<font color=""" & strHiLiteFontColor & """><b><s>N</s></b> </font>"
End If
If Column.Properties("AutoIncrement") Then
strType = "AutoIncrement"
strN = "<font color=""" & strHiLiteFontColor & """><b><s>N</s></b> </font>"
End If
Response.Write strType & " </font></td>" & vbNewLine & _
" <td align=right><font color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """ face=""" & strDefaultFontFace & """>"&intCS&"</font></td>" & vbNewLine & _
" <td align=center>" & strN & "</td>" & vbNewLine & _
" <td align=absmiddle>" & vbNewLine & _
" <a href=""admin_db_defs.asp?cedit=" & Column.Name & "&tname=" & Table.Name &"""" & dWStatus("Edit") & "><acronym style=""border:none; text-decoration:none"" title=""Edit""><img src="""& strImageURL &"icon_pencil.gif"" height=""16"" width=""16"" alt=""Edit"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" <a href=""admin_db_defs.asp?cdelete=" & Column.Name & "&tname=" & Table.Name &"""" & dWStatus("Delete") & "><acronym style=""border:none; text-decoration:none"" title=""Delete""><img src="""& strImageURL &"icon_trashcan.gif"" height=""16"" width=""16"" alt=""Delete"" style=""border:none; text-decoration:none;""></acronym></a>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr />"
intI = 1 - intI
Next
End If
Next
If intI = 0 Then CColor = strForumCellColor Else CColor = strAltForumCellColor
Response.Write " <tr bgColor=""" & CColor & """>" & vbNewLine & _
" <td align=""center""><input type=""text"" name=""cplus"" value=""" & Request("cplus") & """ style=""background-color:" & CColor & "; text-align:center; font-weight:bold; color:maroon; width:98%;"" /></td>" & vbNewLine & _
" <td align=""left"">" & vbNewLine & _
" <select name=""ctype"">" & vbNewLine & _
" <option style=""width:98%; background:lightblue; color:navy; font-weight:bold;"" value=""Choose Type"" selected>Choose Type</option>" & vbNewLine
If strDBType <> "sqlserver" Then
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "OLEObject" Else Response.Write "BLOB"
Response.Write """>Attachment</option>" & vbNewLine
End If
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""AutoIncrement"">AutoIncrement</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Byte"">Byte</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""Char"">Char</option>" & vbNewLine
If stDBType <> "mysql" Then
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Currency" Else Response.Write "Money"
Response.Write """>Currency</option>" & vbNewLine
End If
Response.Write " <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Date/Time" Else Response.Write "DateTime"
Response.Write """>Date/Time</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Double" ElseIf strDBType="mysql" Then Response.Write "SmallInt(2)" Else Response.Write "SmallInt"
Response.Write """>Double</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Long" Else Response.Write "BigInt"
Response.Write """>Long Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Memo" Else Response.Write "Text"
Response.Write """>Memo</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Single" ElseIf strDBType="mysql" Then Response.Write "TinyInt(1)" Else Response.Write "TinyInt"
Response.Write """>Single</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value="""
If strDBType = "access" Then Response.Write "Short" Else Response.Write "Int"
Response.Write """>Small Int</option>" & vbNewLine & _
" <option style=""width:98%; background:" & CColor & "; color:maroon; font-weight:bold;"" value=""VarChar"">VarChar</option>" & vbNewLine & _
" </select>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""left"">" & vbNewLine & _
" <input name=""csize"" value=""" & Request("csize") & """ style=""background:" & CColor & "; text-align:center; font-weight:bold; color:maroon; width:98%;"" /></td>" & vbNewLine & _
" </td>" & vbNewLine & _
" <td align=""center"">" & vbNewLine & _
" Yes:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""cnull"" value=""1""" & chkRadio(cnull,0,false) & "> No:<input type=""radio"" class=""radio"" style=""background:" & CColor & ";"" name=""cnull"" value=""0""" & chkRadio(cnull,0,true) & ">" & vbNewLine & _
" </td>" & vbNewLine & _
" <td>" & vbNewLine & _
" <input style=""color:" & strHeadFontColor & "; font-weight:bold; font-family:" & strDefaultFontFace & "; padding:3px 6px 3px 6px; border:1px solid " & strTableBorderColor & "; text-shadow:0px 1px 1px #000; text-decoration none; border-radius:25px; -moz-border-radius:25px; -webkit-border-radius:25px; background:" & strHeadCellColor & ";"" type=""Submit"" class=""button2"" name=""Fielded"" value=""Add Field"" />" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr />" & vbNewLine & _
" </table>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>" & vbNewLine & _
"<p align=center><a href=""admin_db_defs.asp"">Back to Tables</a></p>"
adodbConn.Close
Set adodbConn = Nothing
Set adoxConn = Nothing
End Function
Sub DropDownPaging(fnum)
If intTotalPages > 1 Then
Response.Write "<form name=""PageNum"&fnum & """ action=""admin_db_defs.asp"" >" & vbNewLine & _
" <input type=""hidden"" name=""tview"" value=""" & Request("tview") & """ />" & vbNewLine & _
" <table align=""right"" cellpadding=""0"" cellspacing=""0"" border=""0"">" & vbNewLine & _
" <tr>" & vbNewLine & _
" <td nowrap align=""right"">" & vbNewLine & _
" <font face=""" & strDefaultFontFace & """ color=""" & strDefaultFontColor & """ size=""" & strDefaultFontSize & """>" & vbNewLine & _
" <select name=""page"" onchange=""this.form.submit();"">" & vbNewLine
For PgCnt = 1 to intTotalPages
Response.Write "<option value=""" & PgCnt & """"
If PgCnt = mypage Then
Response.Write " selected"
End If
Response.Write ">" & PgCnt & "</option>" & vbNewLine
Next
Response.Write " </select> of <b>" & intTotalPages & "</b></font>" & vbNewLine & _
" </td>" & vbNewLine & _
" </tr>" & vbNewLine & _
" </table>" & vbNewLine & _
"</form>"
End If
End Sub
%>