| 网站首页 | 业界新闻 | 小组 | 威客 | 人才 | 下载频道 | 博客 | 代码贴 | 在线编程 | 编程论坛
欢迎加入我们,一同切磋技术
用户名:   
 
密 码:  
共有 491 人关注过本帖
标题:郁闷啊、、我刚入手。asp无法连接到数据库
只看楼主 加入收藏
飞剑嗔
Rank: 1
来 自:南乐
等 级:新手上路
帖 子:4
专家分:8
注 册:2010-9-13
结帖率:0
收藏
已结贴  问题点数:20 回复次数:1 
郁闷啊、、我刚入手。asp无法连接到数据库
<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>

<%
if request ("method")="value" then
set conn=server.createobject("adodb.connection")
conn.open"provider=microsoft.jet.oledb.4.0; data source=" & server.MapPath("link.mdb")
conn.execute "insert into link_aa (link_name,link_address,link_info) values('"&request("link_name")&"','"&request("link_address")&"','"&request("link_info")&"')"

%>
<SCRIPT LANGUAGE="JavaScript">

alert("成功")
</script>
<%
end if
%>


<table width="200" border="0" align="center">
  <tr>
    <th scope="row"><div align="right">网站名称</div></th>
    <td><form id="form2" name="form2" method="post" action="">
      <label>
      <input type="text" name="textfield" id="link_name" />
      </label>
    </form>    </td>
  </tr>
  <tr>
    <th scope="row"><div align="right">网站地址</div></th>
    <td><form id="form3" name="form3" method="post" action="index.asp">
      <label>
        <input name="link_address" type="text" id="link_address" />
        </label>
    </form>    </td>
  </tr>
  <tr>
    <th scope="row"><div align="right">网站描述</div></th>
    <td><form id="form4" name="form4" method="post" action="index.asp">
      <label>
        <input name="link_info" type="text" id="link_info" />
        <input name="method" type="hidden" value="save" />
        </label>
    </form>    </td>
  </tr>
  <tr>
    <th colspan="2" scope="row"><form id="form1" name="form1" method="post" action="index.asp">
      <label>
        <input type="submit" name="Submit" value="提交" />
        </label>
    </form>    </th>
  </tr>
</table>
<%
if request ("method")="value" then
conn.close
set conn=nothing
end if
%>
</body>
</html>
搜索更多相关主题的帖子: 数据库 asp 
2010-09-24 10:10
wangjy500
Rank: 11Rank: 11Rank: 11Rank: 11
等 级:贵宾
威 望:13
帖 子:457
专家分:2569
注 册:2010-7-11
收藏
得分:20 
不是连接数据库的问题!
是你程序有问题。
一个form可解决的事。你用了4个
当然会有问题。

<%@LANGUAGE="VBSCRIPT" CODEPAGE="936"%>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.
<html xmlns="http://www.
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312" />
<title>无标题文档</title>
</head>

<body>

<%
if request.form("method")="save" then
set conn=server.createobject("adodb.connection")
conn.open"provider=microsoft.jet.oledb.4.0; data source=" & server.MapPath("link.mdb")
conn.execute "insert into link_aa (link_name,link_address,link_info) values('"&request("link_name")&"','"&request("link_address")&"','"&request("link_info")&"')"

%>
<SCRIPT LANGUAGE="JavaScript">
alert("成功");
</script>
<%
end if
%>

<form id="form1" name="form1" method="post" action="index.asp">
<table width="200" border="0" align="center">
  <tr>
    <th scope="row"><div align="right">网站名称</div></th>
    <td>
      <label>
      <input type="text" name="textfield" id="link_name" />
      </label>
   </td>
  </tr>
  <tr>
    <th scope="row"><div align="right">网站地址</div></th>
    <td>
      <label>
        <input name="link_address" type="text" id="link_address" />
        </label>
    </td>
  </tr>
  <tr>
    <th scope="row"><div align="right">网站描述</div></th>
    <td>
      <label>
        <input name="link_info" type="text" id="link_info" />
        <input name="method" type="hidden" value="save" />
        </label>
   </td>
  </tr>
  <tr>
    <th colspan="2" scope="row">
      <label>
        <input type="submit" name="Submit" value="提交" />
        </label>
      </th>
  </tr>
</table> </form>

</body>
</html>
<%
conn.close
set conn=nothing
%>

QQ:63572063
2010-09-24 12:51
快速回复:郁闷啊、、我刚入手。asp无法连接到数据库
数据加载中...
 
   



关于我们 | 广告合作 | 编程中国 | 清除Cookies | TOP | 手机版

编程中国 版权所有,并保留所有权利。
Powered by Discuz, Processed in 0.013037 second(s), 7 queries.
Copyright©2004-2024, BCCN.NET, All Rights Reserved