注册 登录
编程论坛 ASP技术论坛

查询SQL数据里的数据,求高手帮忙!

tanghong 发布于 2010-01-30 19:12, 633 次点击
数据库是现成的,现在我想做个ASP查询的网页,输入会员号,可以查出会员总积分,已经消费积分,剩余积分.

数据库名字hbposv6 查询的表名:t_rm_vip_info 会员号:card_id 会员总积分:acc_num 已经消费积分:dec_num (剩余积分没找到,最好也能实现这个显示)

用的是SQL数据库,最好把conn.asp , search.asp,还有搜索结果页这个3个网页的代码写一下,可以让我直接用,谢谢..



........
3 回复
#2
icecool2010-01-30 20:46

conn.asp:
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("hbposv6.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNECTION")
conn.open connstr
%>

search.asp:

<form method="POST" action="result.asp">
<input type="text" name="card_id" size="30">
<input type="submit" value="查询" name="B1">
</form>

result.asp:

<!--#include file="conn.asp"-->
<%
s_id=replace(card_id," ","")
set rs=conn.execute("select*from t_rm_vip_info where (card_id = '"&s_id&"')")
  if rs.eof then
     response.write "查询的ID不存在"
     response.end
  end if

response.write "会员号:" & s_id & "<br>"
response.write "总积分:" & rs("acc_num")
response.write "消费积分:" & rs("dec_num")
rs.close()
set rs=nothing
conn.close()
set conn=nothing
%>
     
#3
tanghong2010-01-31 16:30
以下是引用icecool在2010-1-30 20:46:28的发言:


conn.asp:
<%
dim conn
dim connstr
on error resume next
connstr="DBQ="+server.mappath("hbposv6.mdb")+";DefaultDir=;DRIVER={Microsoft Access Driver (*.mdb)};"
set conn=server.createobject("ADODB.CONNEC ...
我用的是SQL数据库呀....
#4
icecool2010-02-03 21:57
那你换成下的好了:


set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "driver=SQL Server; server=sql服务器地址; uid=username; pwd=password;database=hbposv6;"
1