修改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>

阅读更多
想对作者说点什么?

博主推荐

换一批

没有更多推荐了,返回首页