请输入您要查询的百科知识:

 

词条 asp aspasp
释义

<%

MM_conn_STRING = "PROVIDER=SQLOLEDB;DATA SOURCE=.;UID=sa;PWD=;DATABASE=xsk" '定义数据库连接字符串,指定是用数据库信息

set myconn = Server.CreateObject("adodb.connection")'创建的数据库连接

myconn.Open MM_conn_STRING '打开用后面的信息打开连接

Set Recordset1 = Server.CreateObject("ADODB.Recordset")'创建数据集,相当数据库里面的表

Recordset1.ActiveConnection = myconn '指定数据库连接

Recordset1.Source = "SELECT * FROM dbo.cjb" '指定具体的数据集,相当一个SQL语句

Recordset1.Open() '打开数据集

%>

<table border="1">

<tr>

<td>xh</td>

<td>bj</td>

<td>xm</td>

<td>xb</td>

<td>nwcj</td>

<td>sxcj</td>

</tr>

<%

while not Recordset1.eof '当他没达到最后一条记录

%>

<tr>

<td><%=(Recordset1.Fields.Item("xh").Value)%></td>

<td><%=(Recordset1.Fields.Item("bj").Value)%></td>

<td><%=(Recordset1.Fields.Item("xm").Value)%></td>

<td><%=(Recordset1.Fields.Item("xb").Value)%></td>

<td><%=(Recordset1.Fields.Item("nwcj").Value)%></td>

<td><%=(Recordset1.Fields.Item("sxcj").Value)%></td>

</tr>

<%

Recordset1.moveNext()

wend

Recordset1.close()

%>

</table>

随便看

 

百科全书收录4421916条中文百科知识,基本涵盖了大多数领域的百科知识,是一部内容开放、自由的电子版百科全书。

 

Copyright © 2004-2023 Cnenc.net All Rights Reserved
更新时间:2025/3/14 15:51:58