在ASP中,在循环中怎么把数据库中的值放在文本框里

时间:2022-11-06 11:14:06
数据库(自我评分)如下:

ID    score1    score2   score3   score4    score5
1       20        10       30       40        80
代码如下:
<%
Response.Buffer = true
ConnDB()
Set rs = CreateObject("ADODB.RecordSet")
Set rs2 = CreateObject("ADODB.RecordSet")
FlagID = Session("ID")
cpwd = request("cpwd")
npwd = request("npwd")
XM = Session("姓名")

scoreA1 = request("scoreA1")
scoreA2 = request("scoreA2")
scoreA3 = request("scoreA3")
scoreA4 = request("scoreA4")
scoreA5 = request("scoreA5")
sql = "select * from 自我评分 where  工号 ='"&FlagID&"'"
      rs.Open sql, conn, 1, 3
      If Not rs.EOF Then
      scoreA1 = rs("score1")
      scoreA2 = rs("score2")
      scoreA3 = rs("score3")
      scoreA4 = rs("score4")
      scoreA5 = rs("score5")
rs.Close
 end if
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=gb2312">
<title>考核表</title>
</head>
<body class="body2">
<form name="form1" method="post" onSubmit="return FormAdd(this);">
<input name="FlagID" type="hidden" id="FlagID" value="<%=FlagID%>">
<table width="100%" border="1" cellpadding="1" cellspacing="1" bgcolor="#ffffff" bordercolordark="#0000FF">
  <tr>
    <td height="25" colspan="5" align="center" bgcolor="#CC0000" class="biaoTi2">(<%=XM%>)岗位责任考核表</td>
    </tr>
  <tr>
    <td height="20" colspan="2" align="left" class="td"><%=y %>年第<%=j %>季度</td>
    <td height="20" colspan="3" align="left" class="td">按考核系数140%得总分:</td>
   <tr>
    <td height="20" width="5%" align="center" class="td">序号</td>
     <td height="20" width="80%" align="center"class="td">考&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;核&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;内&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;容</td> 
      <td height="20" width="5%" align="center" class="td">标准分</td>   
      <td height="20" width="5%" align="center" class="td">自评分</td> 
      <td height="20" width="5%" align="center" class="td">考评分</td>    
  </tr>
<% 'response.end
sql = "select * from 内容表 where 工号 = '"&FlagID&"'"
i = 0
rs.open sql,conn,1,3
if not rs.eof then
while not rs.eof
i = i + 1

%>   
   <tr>
    <td height="10%" align="center" class="td"><%=rs("序号") %></td>
     <td height="60%" align="left"class="td"><%=rs("考核内容") %></td> 
      <td height="10%" align="center" class="td"><%=rs("标准分") %></td> 
     <td height="10"align="center" class="td"><input type="text" name="scoreA<%=i%>" id="scoreA<%=i%>"  value="scoreA<%=i %>" size ="3"/></td> 
   //?????用value="scoreA<%=i %>" 这句代码在网页中文本框依次显示scoreA1、scoreA2  scoreA3  scoreA4  scoreA5,并不是数据库里20 、 10 、 30 、 40 、  80。请问要怎么写才能循环得到数据中的各项值。????//
      <td height="10" align="right" class="td">&nbsp;</td>    
  </tr>
<%
     rs.MoveNext
Wend
rs.close
end If


%>

2 个解决方案

#1


"CCU_Adapt.h"<pthread.h>"CCU_485Init.h"/* 适配函数打印开关 */UINT8 g_ucAdaPrtMat = CCU_FALSE;
extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
#define ADA_PRINTF_INFO(format, args...) \
    DBG_INFO(g_ucAdaPrtMat, format, ##args)
#define ..ERR(..) \DBG_ERROR(..)
extern UINT32 CheckTime(struct tm *pstTime);
.. .. BSP_GetBoardOnLineStatus(UINT8 ucSlotId, UINT8 *enState);
.. INT32  BSP_GetBoardType(.., UINT8* pucCardType);

INT32 g_iTimeZone = 0;UINT8 g_uc.. = 0;
.. g_ucTimeFlag = 0x2B; /* 设置的是正或者负时区 字符号(‘+' , '-') */
.. ..Min  = 0; /* 设置与时区偏差的时间 */
1 return (g_ucAdaPrtMat = !g_ucAdaPrtMat);
2 ADA_PRINTF_ERR 21 strerror(errno) 24
struct semid_ds strseminfo;unsigned short value = 1;union semun arg;
arg.val = ucValue;arg.__buf = 0;arg.buf = &strseminfo;arg.array = &value;
/*SETALL 按第四个参数指向的数组的值来设置该集合中所有信号量的值 */
/*semctl 信号量操作函数,第四个参数可选,如果使用该参数,其类型是semun
它是多个特定命令参数的联合 */
if (-1 == semctl(iSem, 0, SETALL, arg) )
{21("Semctl sem %d error, %s", (INT)iSem, 24);222;}221;
3   INT32 iRet  = (INT32)CCU_NULL_LONG 31  ADA_CreatMutexSem 32 ADA_SmP 33
    31;CHECK;iRet = 32(iKey, pulSem);CHECK(iRet, iRet);33(*pulSem, 0); 221;
4   iQueid 42 IPC_CREAT 43 msgget 44
INT32 42 = (INT32)CCU_NULL_LONG;.. ulRet     = ..;CHECK;42 = 44((key_t)(iKey), 43 | IPC_EXCL);
if (42 < 0){42 = 44(iKey, 43);if (42 < 0){21("Creat Quene error, %s", 24);222;}
/* 说明队列存在 删除原先的队列重新创建 */ulRet = msgctl(42, IPC_RMID, NULL);
if (CCU_OK != ulRet){21("Delete queue is fail errno reason is %s", 24);
222;}ADA_PRINTF_INFO("Delete queue success.");42 = 44(iKey, 43);
if (42 < 0){21("Creat Quene error, %s", 24);222;}}*piQueId = 42;221;
5 *plSem = semget(iKey, 1, 43    用  52    if( *plSem < 0 ) 53  iRet = CCU_ERR 54  return iRet 56
  CCU_OK != iRet 57
    //尝试直接创建信号量int iRet = CCU_OK;
    CHECK;/*52 获得或创建一个信号集ID
    第二个参数,是指定集合中的信号灯数,如果我们不创建,只是访问一个存在的信号集合,可以置0
    一旦创建了一个信号灯集,就不能改变其信号灯数了*/

#2


 52 | IPC_EXCL);
/*成功时为非负标帜符,即信号灯标帜符,出错返回-1 */   53{
/* 已经存在,不需要创建,因为没有IPC_EXCL ,即使信号量存在,也不会失败,而是关联的信号量标志 */
52;53{21("Create mutex semid error, %s", 24);54;}
/* 删除时 可以用0 */iRet = semctl((INT)*plSem, 0, IPC_RMID, 1);
if (57){21("Delete semphore is fail errno reason is %s", 24);222;}
#if 152;53{21("Creat mutex semid error, %s", 24);54;}#endif}else{;}
/* 必需创建时将初值置为1,否则P互斥信号量会挂住 */iRet = SetSemValue(*plSem, 1);56;
6  semops.sem_flg = IPC_NOWAIT 61  semops.sem_op 62  semops.sem_num = 0 63  ulMsPerTime 68
   struct sembuf semops 64  semop(SemId, &semops, 1) 65 ulCurTime 66  ulTotalTimes 67
    UINT32 68 = 50; /*每次P的挂起时间*/.. 66 = 0;  /*已经P的次数*/
 .. 67 = ulTimeout / 68;  /*尝试P的次数*/64;61;62  = -1;63 = 0;
/* 此处判断条件要为小于等于,不然创建同步信号量初值减一 会失败 */while(66 <= 67){if (0 == 65){221;
}if(66 != 67){usleep(1000 * 68); /*最后一次P后不用再挂起*/} 66++;}222;
7   64;  63;62 = -1;semops.sem_flg = 0;
if ( 65 ){ 21("Semid = %d error, %s", (INT)SemId, 24); 222;}221;        
8 while(CCU_OK == 33(SemId, 0)){usleep(1000);}return 33(SemId, ulTimeout);
9  (INT32)g_pstConfigSemMutexId == SemId 91
if (91){return ADA_MutexP((pthread_mutex_t*)SemId);}
if (CCU_WAIT_FOREVER == ulTimeout)
{ return ADA_PendSmP(SemId);} else{return ADA_TimeSmP(SemId, ulTimeout);}
10   CHECK;if ( CCU_OK != 32(iKey,(INT32*)pulSem) ){222;}
/* 此处只是P一次,确保P成同步信号量 */33((INT32)(*pulSem), 0);221;
11   64;  63;62 = 1;61;
if (91){return ADA_MutexV((pthread_mutex_t*)SemId);}
if ( 65 ){21("Semid = %d error, %s", (INT)SemId, 24);222;}221;        
12
31;CHECK;iRet = msgsnd(42, pBuf, (UINT)iSize, 0);
if(57){21("Send msg to queue %d fail, %s", 42, 24);222;}221;
13  31;CHECK;iRet = msgsnd(42, pBuf, iSize, IPC_NOWAIT);
if (57){21("Send msg to queue %d fail, %s\n", (INT)42, 24);222;}221;
14 iSize != (UINT32)iRet 140
31;CHECK;/* 读不到就阻塞住 */iRet = msgrcv(42, pBuf, iSize, (INT32)ulType, 0);
if (140){21("Read msg from queue %d fail, %s", (INT)iQueId, 24);222;}221;
15
31;CHECK;iRet = msgrcv(42, pBuf, iSize, (INT32)ulType, IPC_NOWAIT);if (140){222;}221;
16
volatile UINT32 i; .. .. j;
for (i = 0; i <  ulMSec; i++){for ( j = 0; j < TIME_OF_1MS_CNT; j++){;}}
17
VOID ADA_Sleep(UINT32 ulMSec){usleep(ulMSec * 1000);}

#1


"CCU_Adapt.h"<pthread.h>"CCU_485Init.h"/* 适配函数打印开关 */UINT8 g_ucAdaPrtMat = CCU_FALSE;
extern int pthread_mutexattr_settype(pthread_mutexattr_t *attr, int type);
#define ADA_PRINTF_INFO(format, args...) \
    DBG_INFO(g_ucAdaPrtMat, format, ##args)
#define ..ERR(..) \DBG_ERROR(..)
extern UINT32 CheckTime(struct tm *pstTime);
.. .. BSP_GetBoardOnLineStatus(UINT8 ucSlotId, UINT8 *enState);
.. INT32  BSP_GetBoardType(.., UINT8* pucCardType);

INT32 g_iTimeZone = 0;UINT8 g_uc.. = 0;
.. g_ucTimeFlag = 0x2B; /* 设置的是正或者负时区 字符号(‘+' , '-') */
.. ..Min  = 0; /* 设置与时区偏差的时间 */
1 return (g_ucAdaPrtMat = !g_ucAdaPrtMat);
2 ADA_PRINTF_ERR 21 strerror(errno) 24
struct semid_ds strseminfo;unsigned short value = 1;union semun arg;
arg.val = ucValue;arg.__buf = 0;arg.buf = &strseminfo;arg.array = &value;
/*SETALL 按第四个参数指向的数组的值来设置该集合中所有信号量的值 */
/*semctl 信号量操作函数,第四个参数可选,如果使用该参数,其类型是semun
它是多个特定命令参数的联合 */
if (-1 == semctl(iSem, 0, SETALL, arg) )
{21("Semctl sem %d error, %s", (INT)iSem, 24);222;}221;
3   INT32 iRet  = (INT32)CCU_NULL_LONG 31  ADA_CreatMutexSem 32 ADA_SmP 33
    31;CHECK;iRet = 32(iKey, pulSem);CHECK(iRet, iRet);33(*pulSem, 0); 221;
4   iQueid 42 IPC_CREAT 43 msgget 44
INT32 42 = (INT32)CCU_NULL_LONG;.. ulRet     = ..;CHECK;42 = 44((key_t)(iKey), 43 | IPC_EXCL);
if (42 < 0){42 = 44(iKey, 43);if (42 < 0){21("Creat Quene error, %s", 24);222;}
/* 说明队列存在 删除原先的队列重新创建 */ulRet = msgctl(42, IPC_RMID, NULL);
if (CCU_OK != ulRet){21("Delete queue is fail errno reason is %s", 24);
222;}ADA_PRINTF_INFO("Delete queue success.");42 = 44(iKey, 43);
if (42 < 0){21("Creat Quene error, %s", 24);222;}}*piQueId = 42;221;
5 *plSem = semget(iKey, 1, 43    用  52    if( *plSem < 0 ) 53  iRet = CCU_ERR 54  return iRet 56
  CCU_OK != iRet 57
    //尝试直接创建信号量int iRet = CCU_OK;
    CHECK;/*52 获得或创建一个信号集ID
    第二个参数,是指定集合中的信号灯数,如果我们不创建,只是访问一个存在的信号集合,可以置0
    一旦创建了一个信号灯集,就不能改变其信号灯数了*/

#2


 52 | IPC_EXCL);
/*成功时为非负标帜符,即信号灯标帜符,出错返回-1 */   53{
/* 已经存在,不需要创建,因为没有IPC_EXCL ,即使信号量存在,也不会失败,而是关联的信号量标志 */
52;53{21("Create mutex semid error, %s", 24);54;}
/* 删除时 可以用0 */iRet = semctl((INT)*plSem, 0, IPC_RMID, 1);
if (57){21("Delete semphore is fail errno reason is %s", 24);222;}
#if 152;53{21("Creat mutex semid error, %s", 24);54;}#endif}else{;}
/* 必需创建时将初值置为1,否则P互斥信号量会挂住 */iRet = SetSemValue(*plSem, 1);56;
6  semops.sem_flg = IPC_NOWAIT 61  semops.sem_op 62  semops.sem_num = 0 63  ulMsPerTime 68
   struct sembuf semops 64  semop(SemId, &semops, 1) 65 ulCurTime 66  ulTotalTimes 67
    UINT32 68 = 50; /*每次P的挂起时间*/.. 66 = 0;  /*已经P的次数*/
 .. 67 = ulTimeout / 68;  /*尝试P的次数*/64;61;62  = -1;63 = 0;
/* 此处判断条件要为小于等于,不然创建同步信号量初值减一 会失败 */while(66 <= 67){if (0 == 65){221;
}if(66 != 67){usleep(1000 * 68); /*最后一次P后不用再挂起*/} 66++;}222;
7   64;  63;62 = -1;semops.sem_flg = 0;
if ( 65 ){ 21("Semid = %d error, %s", (INT)SemId, 24); 222;}221;        
8 while(CCU_OK == 33(SemId, 0)){usleep(1000);}return 33(SemId, ulTimeout);
9  (INT32)g_pstConfigSemMutexId == SemId 91
if (91){return ADA_MutexP((pthread_mutex_t*)SemId);}
if (CCU_WAIT_FOREVER == ulTimeout)
{ return ADA_PendSmP(SemId);} else{return ADA_TimeSmP(SemId, ulTimeout);}
10   CHECK;if ( CCU_OK != 32(iKey,(INT32*)pulSem) ){222;}
/* 此处只是P一次,确保P成同步信号量 */33((INT32)(*pulSem), 0);221;
11   64;  63;62 = 1;61;
if (91){return ADA_MutexV((pthread_mutex_t*)SemId);}
if ( 65 ){21("Semid = %d error, %s", (INT)SemId, 24);222;}221;        
12
31;CHECK;iRet = msgsnd(42, pBuf, (UINT)iSize, 0);
if(57){21("Send msg to queue %d fail, %s", 42, 24);222;}221;
13  31;CHECK;iRet = msgsnd(42, pBuf, iSize, IPC_NOWAIT);
if (57){21("Send msg to queue %d fail, %s\n", (INT)42, 24);222;}221;
14 iSize != (UINT32)iRet 140
31;CHECK;/* 读不到就阻塞住 */iRet = msgrcv(42, pBuf, iSize, (INT32)ulType, 0);
if (140){21("Read msg from queue %d fail, %s", (INT)iQueId, 24);222;}221;
15
31;CHECK;iRet = msgrcv(42, pBuf, iSize, (INT32)ulType, IPC_NOWAIT);if (140){222;}221;
16
volatile UINT32 i; .. .. j;
for (i = 0; i <  ulMSec; i++){for ( j = 0; j < TIME_OF_1MS_CNT; j++){;}}
17
VOID ADA_Sleep(UINT32 ulMSec){usleep(ulMSec * 1000);}