`
xqf222
  • 浏览: 117994 次
  • 性别: Icon_minigender_1
  • 来自: 深圳
社区版块
存档分类
最新评论

修改ACCESS数据库字段属性

 
阅读更多


<%response.Buffer=true
'未能完成修改数据表字段名称结果
'目前只设计完成了修改数据表字段属性
'设计思路:1添加新列2拷贝Recordset字段内容到新的字段3删除原来字段
'


dim PathName,TableName,RecordName,ColumnName,ColumnType
Dim RsName,RsType,RsNull,RsDefault,RsPrimary
dim strConn,objConn,rsSchema

if request("act")="GetTableList" then
PathName=cstr(trim(request("PathName")))
if PathName="" then
response.write("<script>alert('数据库的路径不能为空!');history.back(1);</script>")
end if
Session("PathName")=PathName
Call FindPathName(PathName)
call GetTableList(PathName,TableString)
Response.Redirect("Admin_DatabaseRecordset.asp?step=1")
response.End()
end if

if request("act")="GetColumnList" then
PathName=cstr(trim(request("PathName")))
TableName=cstr(trim(request("TableName")))
if PathName="" then
response.write("<script>alert('数据库的路径不能为空!');history.back(1);</script>")
end if
if TableName="" then
response.write("<script>alert('数据表名称不能为空!');history.back(1);</script>")
end if
Call FindTableName(PathName,TableName)
Call ShowTableRecordset(PathName,TableName)
Session("TableName")=TableName
Response.Redirect("Admin_DatabaseRecordset.asp?step=2")
response.End()
end if

if request("act")="GetColumnProperty" then
PathName=cstr(trim(request("PathName")))
TableName=cstr(trim(request("TableName")))
ColumnName=cstr(trim(request("ColumnName")))
if PathName="" then
response.write("<script>alert('数据库的路径不能为空!');history.back(1);</script>")
end if
if TableName="" then
response.write("<script>alert('数据表名称不能为空!');history.back(1);</script>")
end if
if ColumnName="" then
response.write("<script>alert('要修改的字段名称不能为空!');history.back(1);</script>")
end if
Call FindPathName(PathName)
Call FindTableName(PathName,TableName)
Session("ColumnName")=ColumnName
Call FindTableRecordset(PathName,TableName,ColumnName)
Response.Redirect("Admin_DatabaseRecordset.asp?step=3")
response.End()
end if

if request("act")="AlerTableColumn" then

PathName=trim(request("PathName"))
TableName=cstr(trim(request("TableName")))
ColumnName=cstr(trim(request("RsName")))
ColumnType=trim(request("RsType"))
if PathName="" then
response.write("<script>alert('数据库的路径不能为空!');history.back(1);</script>")
end if
if TableName="" then
response.write("<script>alert('数据表名称不能为空!');history.back(1);</script>")
end if
if ColumnName="" then
response.write("<script>alert('要修改的字段名称不能为空!');history.back(1);</script>")
end if
if ColumnType="" then
response.write("<script>alert('要修改的字段类型不能为空!');history.back(1);</script>")
end if
Call FindPathName(PathName)
Call FindTableName(PathName,TableName)
call FindTableRecordset(PathName,TableName,ColumnName)
Call AlerTableColumn(PathName,TableName,ColumnName,ColumnType)
end if

Sub FindPathName(PathName)
Set Fso=server.CreateObject("Scripting.FilesystemObject")
If Fso.FileExists(Server.MapPath(PathName))=false then
Session("PathName")=""
response.write("<script>alert('数据库路径错误:"&Server.MapPath(PathName)&"数据库文件不存在,系统即将返回');location.href='Admin_DatabaseRecordset.asp';</script>")
response.End()
end if
set objConn=nothing
End Sub

Sub FindTableName(PathName,TableName)
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
set rsSchema=objConn.openSchema(20)
rsSchema.movefirst
Res=0
Do Until rsSchema.EOF
if rsSchema("TABLE_TYPE")="TABLE" then
if rsSchema("TABLE_NAME")=tablename then
Res=1
exit do
end if
end if
rsSchema.movenext
Loop
if Res=0 then
Session("TableName")=""
response.write("<script>alert('数据表"&tablename&"不存在,系统即将返回');location.href='Admin_DatabaseRecordset.asp';</script>")
response.End()
end if
set objConn=nothing
End Sub

Sub GetTableList(PathName,TableString)
'dim strConn,objConn,rsSchema
TableString=""
Session("TotalTable")=0
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
set rsSchema=objConn.openSchema(20)
rsSchema.movefirst
Do Until rsSchema.EOF
if rsSchema("TABLE_TYPE")="TABLE" then
TableString=TableString&rsSchema("TABLE_NAME")&";"
Session("TotalTable")=Session("TotalTable")+1
end if
rsSchema.movenext
Loop
if TableString="" then
Session("TotalTable")=0
else
Session("TableList")=left(TableString,len(TableString)-1)
end if
set objConn=nothing
end sub
''查找并显示数据表中所有字段名
Sub GetRecordsetList(PathName,TableName,ColumnName)
Res=0
On Error resume next
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
sql="select * from ["&TableName&"] "
set rs=objConn.execute(sql)
for i=0 to rs.fields.count-1
if i=0 then
ColumnName=rs(i).name&";"
else
ColumnName=ColumnName&rs(i).name&";"
end if
Res=1
next
set rs=nothing
set objConn=nothing
if Res=0 then
response.write("<script>alert('数据表"&tablename&"表中没有任何字段,系统即将返回!');history.go(-1);</script>")
response.End()
end if
End Sub
''查找并显示所有字段名称和属性
Sub GetTableRecordsetList(PathName,TableName)
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
Const adSchemaPrimaryKeys = 28
Const adFldIsNullable = &H00000020

Set rsprimary = objConn.OpenSchema(adSchemaPrimaryKeys, Array(empty, empty, TableName))
do while not rsprimary.eof
if rsprimary("COLUMN_NAME")<>"" then
primarykey=rsprimary("COLUMN_NAME")
else
primarykey=""
end if
rsprimary.movenext
loop
set rsprimary=nothing

sql1="select * from ["&TableName&"] "
set rs=objConn.execute(sql1)
Dim ColumnArrayString,ColumnArray(100)
Session("TotalColumn")=rs.fields.count-1
Session("ColumnArrayString")=""
for i=0 to Session("TotalColumn")
ColumnArrayString=i&";"

if rs(i).name=primarykey then
ColumnArrayString=ColumnArrayString&rs(i).name&" Primarykey;"
else
ColumnArrayString=ColumnArrayString&rs(i).name&";"
end if
select case rs(i).type
case 2
fieldtypestr1="short"
fieldtypestr2="整数"
case 3
if rs(i).Properties("ISAUTOINCREMENT") = True then
fieldtypestr1="Autoincrement"
fieldtypestr2="自动编号"
else
fieldtypestr1="integer"
fieldtypestr2="长整数"
end if
case 4
fieldtypestr2= "单精度数字"
fieldtypestr1="real"
case 5
fieldtypestr2= "双精度数字"
fieldtypestr1="double"
case 6
fieldtypestr2= "货币"
fieldtypestr1="Currency"
case 7
fieldtypestr2= "日期时间"
fieldtypestr1="datetime"
case 11
fieldtypestr2= "是/否"
fieldtypestr1="YesNo"
case 17
fieldtypestr2= "字节型数字"
fieldtypestr1="byte"
case 72
fieldtypestr2= "同步复制ID数字"
fieldtypestr1="Unknown"
case 131
fieldtypestr2= "带小数点数字"
fieldtypestr1="Numeric"
case 202
fieldtypestr2= "文本"
fieldtypestr1="varchar"
case 203
fieldtypestr2= "备注/超级链接"
fieldtypestr1="memo"
case 205
fieldtypestr2= "OLE对象"
fieldtypestr1="OLEObject"
case else
fieldtypestr2= "未知类型"
fieldtypestr1="Unknown"
end select

if rs(i).Properties("ISAutoincrement") = True then
ColumnArrayString=ColumnArrayString&fieldtypestr2&"+"&fieldtypestr1&" Autoincrement;"
else
ColumnArrayString=ColumnArrayString&fieldtypestr2&"+"&fieldtypestr1&";"
end if

ColumnArrayString=ColumnArrayString&rs(i).definedsize&";"

if (rs(i).attributes and &H00000020)=0 then
ColumnArrayString=ColumnArrayString&"Not Null;"
else
ColumnArrayString=ColumnArrayString&"Null;"
end if

ColumnArray(i)=ColumnArrayString&"<br>"
next
for i=0 to Session("TotalColumn")
Session("ColumnArrayString")=Session("ColumnArrayString")&ColumnArray(i)
next
set rs=nothing
set objConn=nothing
End Sub

''查找指定的字段属性
Sub FindTableRecordset(PathName,TableName,ColumnName)
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
Const adSchemaPrimaryKeys = 28
Const adFldIsNullable = &H00000020
On Error resume next
Set primary = objConn.OpenSchema(28, Array(empty, empty, TableName))
primarykey=""
if primary("COLUMN_NAME")<>"" then
primarykey=primary("COLUMN_NAME")
end if
primary.close
set primary=nothing
Res=0
sql1="select * from ["&TableName&"] "
set rs=objConn.execute(sql1)
for i=0 to rs.fields.count-1
if rs(i).name=ColumnName then
Session("RecordProperty")=rs(i).name&";"
if rs(i).name=primarykey then
Session("RecordProperty")=Session("RecordProperty")&"primary;"
else
Session("RecordProperty")=Session("RecordProperty")&"not primary;"
end if

select case rs(i).type
case 2'整数
Session("RecordProperty")=Session("RecordProperty")&"short;"
case 3'自动编号或者长整数
if rs(i).Properties("ISAUTOINCREMENT") = True then
if rs(i).name=primarykey then
Session("RecordProperty")=Session("RecordProperty")&"Autoincrement;"
else
Session("RecordProperty")=Session("RecordProperty")&"AutoIncrement;"
end if
else
Session("RecordProperty")=Session("RecordProperty")&"integer;"
end if
case 4'单精度数字
Session("RecordProperty")=Session("RecordProperty")&"real;"
case 5'双精度数字
Session("RecordProperty")=Session("RecordProperty")&"double;"
case 6'货币
Session("RecordProperty")=Session("RecordProperty")&"Currency;"
case 7'日期时间
Session("RecordProperty")=Session("RecordProperty")&"datetime;"
case 11'是/否
Session("RecordProperty")=Session("RecordProperty")&"YesNo;"
case 17'字节型数字
Session("RecordProperty")=Session("RecordProperty")&"byte;"
case 72'同步复制ID数字
Session("RecordProperty")=Session("RecordProperty")&"Guid;"
case 131'带小数点数字
Session("RecordProperty")=Session("RecordProperty")&"Numeric;"
case 202'文本
Session("RecordProperty")=Session("RecordProperty")&"varchar;"
case 203'备注/超级链接
Session("RecordProperty")=Session("RecordProperty")&"memo;"
case 205'OLE对象
Session("RecordProperty")=Session("RecordProperty")&"OLEObject;"
case else'rs(i).type
Session("RecordProperty")=Session("RecordProperty")&rs(i).type&"Unknown;"
end select
Session("RecordProperty")=Session("RecordProperty")&rs(i).definedsize&";"
if (rs(i).attributes and &H00000020)=0 then
Session("RecordProperty")=Session("RecordProperty")&"Not Null;"
else
Session("RecordProperty")=Session("RecordProperty")&"Null;"
end if

'Session("RecordProperty")=left(Session("RecordProperty"),len(Session("RecordProperty"))-1)
Res=1
end if
next
set rs=nothing
set objConn=nothing
if Res=0 then
Session("RecordName")=""
response.write("<script>alert('数据表"&tablename&"表中查找不到您要修改的字段名"&ColumnName&",系统即将返回!');location.href='Admin_DatabaseRecordset.asp';</script>")
response.End()
end if
End Sub


Sub ShowTableRecordset(PathName,TableName)
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set objConn=server.createobject("Adodb.connection")
objConn.open strConn
Const adSchemaPrimaryKeys = 28
Const adFldIsNullable = &H00000020

Set rsprimary = objConn.OpenSchema(adSchemaPrimaryKeys, Array(empty, empty, TableName))
do while not rsprimary.eof
if rsprimary("COLUMN_NAME")<>"" then
primarykey=rsprimary("COLUMN_NAME")
else
primarykey=""
end if
rsprimary.movenext
loop
set rsprimary=nothing

sql1="select * from ["&TableName&"] "
set rs=objConn.execute(sql1)
Dim ColumnArrayString,ColumnArray(100)
Session("TotalColumn")=rs.fields.count-1
Session("ColumnArrayString")=""
for i=0 to Session("TotalColumn")
ColumnArrayString=i&";"

if rs(i).name=primarykey then
ColumnArrayString=ColumnArrayString&rs(i).name&" Primarykey;"
else
ColumnArrayString=ColumnArrayString&rs(i).name&";"
end if
select case rs(i).type
case 2
fieldtypestr1="short"
fieldtypestr2="整数"
case 3
if rs(i).Properties("ISAUTOINCREMENT") = True then
fieldtypestr1="Autoincrement"
fieldtypestr2="自动编号"
else
fieldtypestr1="integer"
fieldtypestr2="长整数"
end if
case 4
fieldtypestr2= "单精度数字"
fieldtypestr1="real"
case 5
fieldtypestr2= "双精度数字"
fieldtypestr1="double"
case 6
fieldtypestr2= "货币"
fieldtypestr1="Currency"
case 7
fieldtypestr2= "日期时间"
fieldtypestr1="datetime"
case 11
fieldtypestr2= "是/否"
fieldtypestr1="YesNo"
case 17
fieldtypestr2= "字节型数字"
fieldtypestr1="byte"
case 72
fieldtypestr2= "同步复制ID数字"
fieldtypestr1="Unknown"
case 131
fieldtypestr2= "带小数点数字"
fieldtypestr1="Numeric"
case 202
fieldtypestr2= "文本"
fieldtypestr1="varchar"
case 203
fieldtypestr2= "备注/超级链接"
fieldtypestr1="memo"
case 205
fieldtypestr2= "OLE对象"
fieldtypestr1="OLEObject"
case else
fieldtypestr2= "未知类型"
fieldtypestr1="Unknown"
end select

if rs(i).Properties("ISAutoincrement") = True then
ColumnArrayString=ColumnArrayString&fieldtypestr2&"+"&fieldtypestr1&" Autoincrement;"
else
ColumnArrayString=ColumnArrayString&fieldtypestr2&"+"&fieldtypestr1&";"
end if

ColumnArrayString=ColumnArrayString&rs(i).definedsize&";"

if (rs(i).attributes and &H00000020)=0 then
ColumnArrayString=ColumnArrayString&"Not Null;"
else
ColumnArrayString=ColumnArrayString&"Null;"
end if

ColumnArray(i)=ColumnArrayString&"<br>"
next
for i=0 to Session("TotalColumn")
Session("ColumnArrayString")=Session("ColumnArrayString")&ColumnArray(i)
next
set rs=nothing
set objConn=nothing
End Sub

Sub AlerTableColumn(PathName,TableName,ColumnName,ColumnType)
strConn="Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" & Server.MapPath(PathName)
set Conn=server.createobject("Adodb.connection")
On Error Resume Next
Conn.open strConn
sql="Alter Table "&TableName&" Alter Column "
RsName=cstr(trim(request("RsName")))
RsType=cstr(trim(request("RsType")))
RsLenth=trim(request("RsLenth"))
RsNull=cstr(trim(request("RsNull")))
RsDefault=cstr(trim(request("RsDefault")))
select case RsType
case "Autoincrement"
sql=sql&RsName&" Autoincrement "&RsNull
case "varchar"
if RsLenth="" then
sql=sql&RsName&" varchar(50) "&RsNull
else
sql=sql&RsName&" varchar("&cint(RsLenth)&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default '"&RsDefault&"'"
end if

case "memo"
if RsDefault<>"" then
sql=sql&RsName&" memo "&" default '"&RsDefault&"'"
else
sql=sql&RsName&" memo "&RsNull
end if

case "integer" '长整形数据
if RsLenth="" then
sql=sql&RsName&" integer "&RsNull
else
sql=sql&RsName&" integer("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "short" '整形数据
if RsLenth="" then
sql=sql&RsName&" short "&RsNull
else
sql=sql&RsName&" short("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "number"
if RsLenth="" then
sql=sql&RsName&" number "&RsNull
else
sql=sql&RsName&" number("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "real" '单精度型整数
if RsLenth="" then
sql=sql&RsName&" real "&RsNull
else
sql=sql&RsName&" real("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "double" '双精度型整数
if RsLenth="" then
sql=sql&RsName&" double "&RsNull
else
sql=sql&RsName&" double("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "Numeric" '小数
if RsLenth="" then
sql=sql&RsName&" Numeric "&RsNull
else
sql=sql&RsName&" Numeric("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "byte" '字节
if RsLenth="" then
sql=sql&RsName&" byte "&RsNull
else
sql=sql&RsName&" byte("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "datetime" 'Access97支持
if RsDefault="" then
sql=sql&RsName&" datetime "&RsNull
else
sql=sql&RsName&" datetime "&RsNull&" default "&RsDefault
end if

case "date"
if RsDefault="" then
sql=sql&RsName&" date "&RsNull
else
sql=sql&RsName&" date "&RsNull&" default "&RsDefault
end if

case "time"
if RsDefault="" then
sql=sql&RsName&" time "&RsNull
else
sql=sql&RsName&" time "&RsNull&" default "&RsDefault
end if

case "YesNo"
if RsDefault="" then
sql=sql&RsName&" YesNo "&RsNull
else
sql=sql&RsName&" YesNo "&RsNull&" default "&RsDefault
end if

case "Currency"
if RsLenth="" then
sql=sql&RsName&" Currency "&RsNull
else
sql=sql&RsName&" Currency("&RsLenth&") "&RsNull
end if
if RsDefault<>"" then
sql=sql&" default "&RsDefault
end if

case "Hyperlink"
if RsDefault="" then
sql=sql&RsName&" OLEObject "&RsNull
else
sql=sql&RsName&" OLEObject "&RsNull&" default "&RsDefault
end if
case "OLEObject"
if RsDefault="" then
sql=sql&RsName&" OLEObject "&RsNull
else
sql=sql&RsName&" OLEObject "&RsNull&" default "&RsDefault
end if
end select
response.Write(sql)
Conn.Execute(sql)
response.write("<script>alert('数据表"&tablename&"表中字段 "&ColumnName&" 修改成功 ,即将返回');location.href='Admin_DatabaseRecordset.asp';</script>")
Response.end
conn.close
set Conn=nothing
End Sub
%>


<table width="739" border="0" align="center" cellpadding="0" cellspacing="0">
<form id="form1" name="form1" method="post" action="" >
<tr>
<td height="30" colspan="2"><div align="center"><strong><font color="#FF0000">修改数据库表字段</font></strong></div></td>
</tr>
<tr>
<td width="154" height="23">数据库路径:</td>
<td ><input name="PathName" type="text" id="PathName" value="<%=session("PathName")%>" >
( 相对路径 )</td>
</tr>
<%if request("step")="" then%>
<tr align="center">
<td height="25" align="left" >&nbsp;</td>
<td height="25" align="left"><input type="submit" name="Submit2" value="读取所有表名称" onClick="document.form1.action='Admin_DatabaseRecordset.asp?act=GetTableList';"></td>
</tr>
<%end if%>

<tr>
<td height="23">数据表名称:</td>
<td ><%
'response.Write("数据表个数"&Session("TotalTable")&"<br>")
'response.Write("数据表名称"&Session("TableList")&"<br>")
'response.End()%>
<script language="JavaScript">
function FormMenu(targ,selObj,restore){
eval(targ+".location='Admin_DatabaseRecordset.asp?act=GetColumnList&PathName=<%=session("PathName")%>&TableName="+selObj.options[selObj.selectedIndex].value+"'");
//if (restore) selObj.selectedIndex=0;
}
</script>
<select name="TableName" id="TableName" size="1" onChange="FormMenu('self',this,0)">
<option value="">请选择数据表</option>
<%if request("step")>1 then%>
<option value="<%=Session("TableName")%>" selected><%=Session("TableName")%></option>
<%end if%>
<%
if Session("TotalTable")>0 then
TableArray=Split(Session("TableList"),";",-1,1)
for i=0 to Session("TotalTable")-1
%>
<option value="<%=TableArray(i)%>"><%=TableArray(i)%></option>
<%next
else
%>
<option value="">没有数据表</option>
<%end if%>
</select>
</td>
</tr>
<%if request("step")=1 then%>
<tr align="center">
<td height="25" align="left" >&nbsp;</td>
<td height="25" align="left">
<input type="submit" name="Submit2" value="读取所有字段名称" onClick="document.form1.action='Admin_DatabaseRecordset.asp?act=GetColumnList';"></td>
</tr>
<%end if%>
<%if request("step")>1 then
'response.Write(Session("ColumnArrayString"))
dim ArrayRsName(50),ArrayRsType(50),ArrayRsLenth(50),ArrayRsNull(50),ArrayRsefault(50)
ArrayA=split(Session("ColumnArrayString"),"<br>",-1,1)
for i=0 to Session("TotalColumn")
ArrayB=split(ArrayA(i),";",-1,1)
ArrayRsName(i)=ArrayB(1)
ArrayRsType(i)=ArrayB(2)
ArrayRsLenth(i)=ArrayB(3)
ArrayRsNull(i)=ArrayB(4)
next
%>
<tr align="center">
<td height="25" align="left" >字段名称:</td>
<td width="585" height="25" align="left">
<script language="JavaScript">
function changelocation(targ,selObj,restore){
eval(targ+".location='Admin_DatabaseRecordset.asp?act=GetColumnProperty&PathName=<%=session("PathName")%>&TableName=<%=session("TableName")%>&ColumnName="+selObj.options[selObj.selectedIndex].value+"'");
//if (restore) selObj.selectedIndex=0;
}
</script>
<select name="RsName" id="RsName" size="1" onChange="changelocation('self',this,0)">
<%if request("step")>1 then%>
<option value="<%=Session("ColumnName")%>" selected><%=Session("ColumnName")%></option>
<%for i=0 to Session("TotalColumn") %>
<option value="<%=ArrayRsName(i)%>"><%=ArrayRsName(i)%></option>
<%next%>
<%else%>
<option value="" selected>请选择字段名</option>
<%for i=0 to Session("TotalColumn") %>
<option value="<%=ArrayRsName(i)%>"><%=ArrayRsName(i)%></option>
<%next%>
<%end if%>
</select>
请选择要修改的字段名 </td>
</tr>
<%if request("step")=3 then
'response.Write(Session("RecordProperty"))
'response.End()
''
ArrayC=split(Session("RecordProperty"),";",-1,1)
RsName1=ArrayC(0)
RsPrimary=ArrayC(1)
RsType1=ArrayC(2)
RsLenth1=ArrayC(3)
RsNull1=ArrayC(4)
%>
<tr align="center">
<td height="25" align="left" >字段类别:</td>
<td height="25" align="left">

<select name="RsType" size="1" id="RsType">
<option value="Autoincrement" <% if RsType1="Autoincrement" then response.Write("selected")%>>自动编号</option>
<option value="varchar" <% if RsType1="varchar" then response.Write("selected")%> >文本</option>
<option value="memo" <% if RsType1="memo" then response.Write("selected")%>>备 注</option>
<option value="integer" <% if RsType1="integer" then response.Write("selected")%>>长整型整数</option>
<option value="short" <% if RsType1="short" then response.Write("selected")%>>整型整数</option>
<option value="real" <% if RsType1="real" then response.Write("selected")%>>单精度型整数</option>
<option value="double" <% if RsType1="double" then response.Write("selected")%>>双精度型整数</option>
<option value="byte" <% if RsType1="byte" then response.Write("selected")%>>字节型整数</option>
<option value="Numeric" <% if RsType1="Numeric" then response.Write("selected")%>>小数整数</option>
<option value="datetime" <% if RsType1="datetime" then response.Write("selected")%>>日期/时间</option>
<option value="date" <% if RsType1="date" then response.Write("selected")%>>日期</option>
<option value="time" <% if RsType1="time" then response.Write("selected")%>>时间</option>
<option value="Currency" <% if RsType1="Currency" then response.Write("selected")%>>货币</option>
<option value="YesNo" <% if RsType1="YesNo" then response.Write("selected")%>>是/否</option>
<option value="Hyperlink" <% if RsType1="Hyperlink" then response.Write("selected")%>>超链接</option>
<option value="OLEObject" <% if RsType1="OLEObject" then response.Write("selected")%>>OLE对象</option>
</select>
&nbsp;

</td>
</tr>
<tr align="center">
<td height="25" align="left" >字段长度:</td>
<td height="25" align="left"><input name="RsLenth" type="text" id="RsLenth" size="10" value="<%=RsLenth1%>">
&nbsp;</td>
</tr>
<tr align="center">
<td height="25" align="left" >是否为空:</td>
<td height="25" align="left"><select name="RsNull" size="1" id="RsNull">
<option value="Null" <%if RsNull1="Null" then response.Write("selected")%>>允许</option>
<option value="Not Null" <%if RsNull1="Not Null" then response.Write("selected")%>>不允许 </option>
</select>
&nbsp;</td>
</tr>
<tr align="center">
<td height="25" align="left" >默认值:</td>
<td height="25" align="left"><input name="RsDefault" type="text" id="RsDefault" size="25">
&nbsp;</td>
</tr>
<tr align="center">
<td height="25" align="left" >字段说明:</td>
<td width="585" height="25" align="left"><input name="RsDescription" type="text" id="RsDescription" size="35" maxlength="255">
</td>
</tr>
<tr align="center">
<td colspan="2"><input type="submit" name="Submit" value="修改数据库表字段" onClick="document.form1.action='Admin_DatabaseRecordset.asp?act=AlerTableColumn';"> &nbsp;&nbsp;
</td>
</tr>
<%end if%>
<%end if%>

</form>
</table>

分享到:
评论

相关推荐

    Access数据库应用教程(2)

    表是Access数据库存放数据的地方,数据库设计一般都从表的设计开始。表的设计主要包括输入字段名、选择数据类型、设置字段属性、创建主键、创建索引和建立表之间关系等内容。表的基本操作包括如何在数据库窗口和数据...

    Access数据库通用管理系统 9.3

    可新建库、压缩库、增加表、删除表、修改表名、增加字段、删除字段、修改字段属性(包括字段名称、字段类型、字段尺寸)。 十三、密码管理功能。可管理有密码的数据库,并具有设置密码、修改密码、清除密码、破解...

    access数据库设计.doc

    (2) 设置字段属性。 (3) 输入数据:直接输入数据,获取外部数据。 3、 表间关系的建立与修改: (1) 表间关系的概念:一对一,一对多。 (2) 设置参照完整性。 (3) 建立表间关系。 4、 表的维护: (1) ...

    Access入门教程

    目录 Access教程 第一章 Access数据库基础 1 一、数据库的基本知识 1 二、数据库管理系统和数据库应用系统 3 三、Access 2003内部结构 4 1. 表 5 2. 查询 6 3. 窗体 7 4. 报表 8 5. 宏 9 6. 模块 9 7. Web页 10 ...

    asp程序在线管理access数据库

    可以在线管理access数据库的asp程序,其功能可与phpmyadmin相媲美,可以在线建表、添加修改字段列的类型属性,只要是office的access能够实现的功能这个程序能够在线做到。 其功能可谓不强。

    access数据库设计(1).doc

    如下图 【图书表】数据视图 重复上述步骤,依次建立【图书表】、【供应商表】、【订货单表】、【采购员表】、 【图书类别表】、【采购订单表】、【送货方式表】注意细节,相同的字段类型设置相 同的字段属性。...

    Access数据库方法使用技巧

    这两种方法可以将窗体保存到文本文件,然后把文本文件存储到OLE字段里,这样整个窗体的界面与代码都可保存到ACCESS数据表里,这个方法对编写 代码库管理器 非常有用。在使用时,还可即时将文本文件还原到一个窗体,...

    Access 入门学习教程

    Access教程 第一章 Access数据库基础 1 一、数据库的基本知识 1 二、数据库管理系统和数据库应用系统 3 三、Access 2003内部结构 4 1. 表 5 2. 查询 6 3. 窗体 7 4. 报表 8 5. 宏 9 6. 模块 9 7. Web页 10 Access...

    Access 2000数据库系统设计(PDF)---025

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

    Access 2000数据库系统设计(PDF)---002

    673.6.2 将数据库转换为Access 2000格式 683.6.3 将数据库转换为Access 97格式 693.6.4 添加切换面板窗体 693.6.5 创建.mde文件 703.7 疑难解答 703.8 现实世界—HTML帮助或者障碍 71第4章 使用Access数据库和表 724...

    Access 2000数据库系统设计(PDF)---003

    673.6.2 将数据库转换为Access 2000格式 683.6.3 将数据库转换为Access 97格式 693.6.4 添加切换面板窗体 693.6.5 创建.mde文件 703.7 疑难解答 703.8 现实世界—HTML帮助或者障碍 71第4章 使用Access数据库和表 724...

    Access 2000数据库系统设计(PDF)---009

    673.6.2 将数据库转换为Access 2000格式 683.6.3 将数据库转换为Access 97格式 693.6.4 添加切换面板窗体 693.6.5 创建.mde文件 703.7 疑难解答 703.8 现实世界—HTML帮助或者障碍 71第4章 使用Access数据库和表 724...

    Access 2000数据库系统设计(PDF)---018

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

    Access 2000数据库系统设计(PDF)---011

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

    Access 2000数据库系统设计(PDF)---020

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

    Access 2000数据库系统设计(PDF)---001

    673.6.2 将数据库转换为Access 2000格式 683.6.3 将数据库转换为Access 97格式 693.6.4 添加切换面板窗体 693.6.5 创建.mde文件 703.7 疑难解答 703.8 现实世界—HTML帮助或者障碍 71第4章 使用Access数据库和表 724...

    Access2003中文版应用基础教程part1

    1-4-1 不可不知1:更改Access的默认文件格式 1-4-2 不可不知2:转换旧版本的数据库 自我突破练习 第2章 建立数据库基本功 2-1 建立表 2-1-1 使用向导建立表 2-1-2 复制表 2-1-3 更改表名称 2-1-4 删除表 2-1-...

    Access 2000数据库系统设计(PDF)---012

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

    Access 2000数据库系统设计(PDF)---015

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

    Access 2000数据库系统设计(PDF)---027

    31813.3.11 创建选项卡控件 32013.3.12 改变控件类型 32413.4 完成主Personnel Actions Entry窗体 32413.5 使用子窗体/子报表向导创建子窗体 32613.6 修改连续窗体的设计 32813.7 覆盖表的字段属性 32913.8 为打印...

Global site tag (gtag.js) - Google Analytics