一页一页的发吧, select.asp(添加数据信息页) <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="conn1.asp"--> <% set rs=server.CreateObject("adodb.recordset") sql="select * from [database]" rs.open sql,conn1 if rs.eof then%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>无标题文档</title> </head>
<body> <% bt=request("bt") sver=request("server") uid=request("uid") pwd=request("pwd") data=request("database") if bt<>"" then sql="insert into [database]([server],[uid],[pwd],[database])values('"&sver&"','"&uid&"','"&pwd&"','"&data&"')" conn1.execute sql response.Redirect("update.asp") end if %> <form name="form1" method="post" action=""> <table width="669" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="86">服务器地址:</td> <td width="583"><input name="server" type="text" id="server" size="80"></td> </tr> <tr> <td>用户名:</td> <td><input name="uid" type="text" id="uid" size="80"></td> </tr> <tr> <td>用户密码:</td> <td><input name="pwd" type="password" id="pwd" size="80"></td> </tr> <tr> <td>选择数据库:</td> <td><input name="database" type="text" id="database" size="80"></td> </tr> <tr> <td> </td> <td><input name="bt" type="submit" id="bt" value="提交"> <input type="reset" name="Submit2" value="重置"></td> </tr> </table> </form>
</body> </html> <% Else response.Redirect "update.asp" end if%> conn1.asp <% set conn1=server.CreateObject("adodb.connection") ss="driver={microsoft access driver (*.mdb)};dbq="&server.MapPath("date.mdb") conn1.open ss %>
conn.asp(选择数据)代码 <!--#include file="conn1.asp"--> <% set rs=server.CreateObject("adodb.recordset") sql="select * from [database]" rs.open sql,conn1 if not rs.eof then set conn=server.CreateObject("adodb.connection") constr="driver={sql server};server="&rs("server")&";uid="&rs("uid")&";pwd="&rs("pwd")&";database="&rs("database")&"" conn.open constr else response.Write("<script>alert('请添加数据库信息!');window.location='select.asp';</script>") end if %> update.asp(修改数据库信息) <%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%> <!--#include file="conn1.asp"--> <% set rs=server.createobject("adodb.recordset") sql="select * from [database]" rs.open sql,conn1 if rs.eof then response.redirect "select.asp" else bt=request("bt") sver=request("server") uid=request("uid") pwd=request("pwd") data=request("database") if bt<>"" then sql="update [database] set [server]='"&sver&"',[uid]='"&uid&"',[pwd]='"&pwd&"',[database]='"&data&"' " conn1.execute sql response.write("<script>alert('修改成功');window.location='update.asp';</script>") end if%> <html> <head> <meta http-equiv="Content-Type" content="text/html; charset=gb2312"> <title>修改</title> </head>
<body> <form name="form1" method="post" action=""> <table width="669" border="0" align="center" cellpadding="0" cellspacing="0"> <tr> <td width="86">服务器地址:</td> <td width="583"><input name="server" type="text" id="server" value="<%=rs("server")%>" size="80"></td> </tr> <tr> <td>用户名:</td> <td><input name="uid" type="text" id="uid" value="<%=rs("uid")%>" size="80"></td> </tr> <tr> <td>用户密码:</td> <td><input name="pwd" type="password" id="pwd" value="<%=rs("pwd")%>" size="80"></td> </tr> <tr> <td>选择数据库:</td> <td><input name="database" type="text" id="database" value="<%=rs("database")%>" size="80"></td> </tr> <tr> <td> </td> <td><input name="bt" type="submit" id="bt" value="提交"> <input type="reset" name="Submit2" value="重置"></td> </tr> </table> </form> </body> </html> <% End If %> 别外,你用access建一数据库datebase 字段:server,uid,pwd,datebase