佳礼资讯网

 找回密码
 注册

ADVERTISEMENT

查看: 1086|回复: 26

求助。。ASP 的问题

[复制链接]
发表于 24-8-2006 11:34 AM | 显示全部楼层 |阅读模式
请问各位
如何用 vb script 'CHECK STATUS WHETHER IS PASS OR FAILED ' from sql server
有两个loop
第一个loop先loop Student ID
然后再LOOP SUBJECT(MORE THAN 3 SUBJECT) (DISPLAY 出来的TABLE 要COLUMN BY COLUMN)
用FUNCTION CHECK WHETHER THIS STUDENT ID IS PASS ON THIS SUBJECT OR NOT

DISPLAY 出来的TABLE要这样子
student ID math english mandarin
1                 pas  pass        failed
2               pass  pass       failed
3                failed pass     failed


谢谢各位

[ 本帖最后由 stephanie83 于 24-8-2006 11:43 AM 编辑 ]
回复

使用道具 举报


ADVERTISEMENT

发表于 24-8-2006 11:39 AM | 显示全部楼层
??? not understand asking what..what mean display different structure ?? different table coloum and datatype or DATA?
different langauge and database different way. so, you need to provide more info
回复

使用道具 举报

 楼主| 发表于 24-8-2006 11:44 AM | 显示全部楼层
对不起,刚才写错 了
回复

使用道具 举报

发表于 24-8-2006 10:09 PM | 显示全部楼层
可以用SQL的。。。。。
回复

使用道具 举报

 楼主| 发表于 25-8-2006 09:03 AM | 显示全部楼层
原帖由 红发 于 24-8-2006 10:09 PM 发表
可以用SQL的。。。。。



是可以用sql。。
问题是 。。
我需要compare两个table然后
拿到pass or failed
再display 出来

databse table structure 和display 在asp page 的table structure是不同的

所以我要create check function
如何做呢?
没有头绪
回复

使用道具 举报

发表于 25-8-2006 09:15 AM | 显示全部楼层
原帖由 stephanie83 于 25-8-2006 09:03 AM 发表



是可以用sql。。
问题是 。。
我需要compare两个table然后
拿到pass or failed
再display 出来

databse table structure 和display 在asp page 的table structure是不同的

所以我要create check  ...



SQL也可以做到的
回复

使用道具 举报

Follow Us
 楼主| 发表于 25-8-2006 09:47 AM | 显示全部楼层
可以大概讲怎样做吗?
回复

使用道具 举报

发表于 25-8-2006 10:57 AM | 显示全部楼层
大概清楚说明一下你要做什么吧... 你的问题实在含糊的很.
你有那两个 tables? 你要的 result? 你在什么情况下要的 result?
回复

使用道具 举报


ADVERTISEMENT

 楼主| 发表于 25-8-2006 12:59 PM | 显示全部楼层
是这样的

我有两个table
然后我会compare 这两个table to get the status whether failed or pass
出来的table 是这样

student ID subject status
1                math    pass   
1              chinese  pass      
1                english failed
2              math    pass   
2              chinese  pass      
2                english failed
3                math    pass   
3              chinese  pass      
3                english failed

但是TABLE的格式大概要这样
student ID math english mandarin
1                 pas  pass        failed
2               pass  pass       failed
3                failed pass     failed
回复

使用道具 举报

发表于 25-8-2006 01:07 PM | 显示全部楼层
回复

使用道具 举报

发表于 25-8-2006 05:56 PM | 显示全部楼层
to do this using sql is too complicated for you, it will involve subquery. suggest using crystal report or excel to sort this out. if you do not know what is sub-query, then look for google for your type of database, different database may use different syntax
回复

使用道具 举报

 楼主| 发表于 28-8-2006 09:56 AM | 显示全部楼层
原帖由 红发 于 25-8-2006 01:07 PM 发表
http://www.w3schools.com/sql/sql_join.asp

看看这里。



这些我都看了
不过我的有些不同
看看我的table你就知道了
回复

使用道具 举报

发表于 28-8-2006 11:45 AM | 显示全部楼层
原帖由 stephanie83 于 28-8-2006 09:56 AM 发表



这些我都看了
不过我的有些不同
看看我的table你就知道了



之前'青菜'看了一下,没有注意到。

问你一个问题。
如果customer突然说要多加一个subject或她和你说有一个subject name 写错了。 你要如何做呢????
回复

使用道具 举报

 楼主| 发表于 28-8-2006 12:27 PM | 显示全部楼层
原帖由 红发 于 28-8-2006 11:45 AM 发表



之前'青菜'看了一下,没有注意到。

问你一个问题。
如果customer突然说要多加一个subject或她和你说有一个subject name 写错了。 你要如何做呢????



其实另外有一个table for subject 的
table subject
id name
1  math
2  chinese
3 english

所以要加多或更改都很容易
回复

使用道具 举报

发表于 28-8-2006 01:23 PM | 显示全部楼层
原帖由 stephanie83 于 28-8-2006 12:27 PM 发表



其实另外有一个table for subject 的
table subject
id name
1  math
2  chinese
3 english

所以要加多或更改都很容易



then为何你说不能呢??
照例是没有问题的

把你有关的table都写出来吧

[ 本帖最后由 红发 于 28-8-2006 01:25 PM 编辑 ]
回复

使用道具 举报

 楼主| 发表于 28-8-2006 04:01 PM | 显示全部楼层
要怎样写
当这个 STUDENT ID MATCH WITH THE SUBJECT THEN RESPONSE.WRITE(RS(STATUS))
回复

使用道具 举报


ADVERTISEMENT

发表于 28-8-2006 06:05 PM | 显示全部楼层
dunno can use outer left join doing this or not, example:
i)use outer left join to get result
ii)use above as a virtual table something like
select * from ( *** outer left join *** )
iii)modifiy above query, case it if isnull -> fail, if not -> pass something like that.

i'm not really understand ur question, so hope can help you
回复

使用道具 举报

发表于 28-8-2006 06:15 PM | 显示全部楼层
原帖由 stephanie83 于 28-8-2006 04:01 PM 发表
要怎样写
当这个 STUDENT ID MATCH WITH THE SUBJECT THEN RESPONSE.WRITE(RS(STATUS))



对啦
之前那个就可以帮到你了

Employees:
-------------------------------
Employee_ID | Name
-------------------------------
01          | Hansen, Ola
02          | Svendson, Tove
03          | Svendson, Stephen
04          | Pettersen, Kari
-------------------------------

Orders:
-------------------------------
Prod_ID | Product | Employee_ID
-------------------------------
234     | Printer |  01
657     | Table   |  03
865     | Chair   |  03
-------------------------------

SELECT Employees.Name, Orders.Product
FROM Employees
RIGHT JOIN Orders
ON Employees.Employee_ID=Orders.Employee_ID

output:
----------------------------------
Name                 |  Product
----------------------------------
Hansen, Ola          |  Printer
Svendson, Stephen    |  Table
Svendson, Stephen    |  Chair
----------------------------------

different在于你们的table名都不一样把。
用法还是一样的

加油
回复

使用道具 举报

发表于 28-8-2006 06:18 PM | 显示全部楼层
补充一下,
后面你也可以加个WHERE 什么 = 什么的。

结果就出来啦。
回复

使用道具 举报

发表于 28-8-2006 07:08 PM | 显示全部楼层
Public Function DisplayResult(studentID,subjectID)
- SET RS=SERVER.CREATEOBJECT("ADODB.RECORDSET")
- RS.OPEN "SELECT * FROM table_result WHERE ID="&studentID&" AND subject="&subjectID,CONN,1,3
- IF NOT RS.EOF THEN
-- DisplayResult=RS("ResultStatus")
- ELSE
-- DisplayResult="NO RECORD"
- END IF
- RS.CLOSE
- SET RS=NOTHING
End Function


OUTPUT

会员1 的1号科目成绩是: <%=DisplayResult(1,1)%>
会员2 的1号科目成绩是: <%=DisplayResult(2,1)%>
会员3 的2号科目成绩是: <%=DisplayResult(3,2)%>

[ 本帖最后由 bins_188 于 28-8-2006 07:11 PM 编辑 ]
回复

使用道具 举报

您需要登录后才可以回帖 登录 | 注册

本版积分规则

 

ADVERTISEMENT



ADVERTISEMENT



ADVERTISEMENT

ADVERTISEMENT


版权所有 © 1996-2023 Cari Internet Sdn Bhd (483575-W)|IPSERVERONE 提供云主机|广告刊登|关于我们|私隐权|免控|投诉|联络|脸书|佳礼资讯网

GMT+8, 23-9-2024 07:19 PM , Processed in 0.107132 second(s), 21 queries , Gzip On.

Powered by Discuz! X3.4

Copyright © 2001-2021, Tencent Cloud.

快速回复 返回顶部 返回列表