當前位置:首頁 » 編程語言 » asp輸出sql

asp輸出sql

發布時間: 2022-05-06 06:54:25

㈠ asp如何輸出數據表數據

if rs.eof and rs.bof then

response.write "沒有相關新聞!"
else
response.write "<li>"&rs("content_cn") 'title為數數據表的欄位名稱

end if

要循環將數據讀出來,將上面那段改成下面的形式,就可以了

if rs.eof and rs.bof then
response.write "沒有相關新聞!"
else
while not(rs.eof)
response.write "<li>"&rs("content_cn")&"</li>"
rs.movenext
wend
end

㈡ asp 怎麼導出從sql中查詢的結果有分頁

1.ASP導出SQL中的查詢結果:
<%@LANGUAGE="VBSCRIPT" CODEPAGE="65001" %>
<!--#include file="../inc/DBConn.asp"-->
<%
'自行設置的,用於DB Connection連接的函數
Call openConnection()
Dim sql,rs,conn
'SQL語句
sql = " SELECT tbId,tbName from Table"
'執行SQL語句,並將結果賦給RS變數
set rs = Conn.execute(sql)
'對從DB中取得的結果進行操作,當有值時執行以下內容
if Not rs.Eof then
』對結果集進行循環操作,將值輸出到畫面中
Do while NOT Rs.Eof
response.write(rs("tbId") & "----" & rs("tbName") & "<br>")
rs.MoveNext
Loop
End If

%>

---
call openconnection()是自己做一個加接DB的函數,
dim strConnect
strConnect = "Provider=SQLOLEDB;Data Source=local;Initial Catalog=" testDb;user ID=sa;password=sa;"

Function openConnection()
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open strConnect
End Function

㈢ asp 顯示sql資料庫 內容的代碼

簡單一點的 自己看看
<%
dim conn
set conn=server.CreateObject("ADODB.Connection")
conn.open "driver={sql server};server=local ;uid=sa;pwd=sa;database=db"
set rs=server.CreateObject("adodb.recordset")
sql="select top 20 level,exp from player order by id desc"
rs.open sql,conn,1,1
%>
<table width="500" >
<%do while not rs.eof%>
<tr><td><%response.Write rs("lever")&rs("exp")%></td></tr>
<%rs.movenext
loop
rs.close
set rs=nothing%>
</table>

㈣ ASP中二維數組賦值和輸出來 SQL調用

<div class="left_5_photo_zs_bg_bg"><%
For i = 0 To 12%>
<div class="left_5_photo_zs_bg_bg_1"><a href="#" target="_blank"><img src="../<%=a(i,0)%>" width="97px" height="135px" /><span><%=left(cleanword(a(i,2)),10)%></span></a></div><%
Next%>
</div>
這樣就可以了.

for j = 0 to 2
a(i,0)=rs("picurl")
a(i,1)=rs("content")
a(i,2)=rs("title")
next
這段代碼,如果你直接用欄位名,就可以不用這個循環了,直接寫成
a(i,0)=rs("picurl")
a(i,1)=rs("content")
a(i,2)=rs("title")
就可以了.

㈤ asp輸出sql查詢的結果應該怎麼寫

通常,有兩種方法可以顯示。
第一,直接:response.write rs(0)
第二,sql語句改一下:sql="select count(*) as ct from urldo where urlna='"&session("name")&"'"
然後,response.write rs(「ct")

㈥ 如何在asp網頁中顯示SQL語句

我知道你的意思了,你目的不是要顯示SQL語句,是要輸出SQL語句有沒有錯誤
在你的SQL語句後面換行
response.write(sql)
response.end()
就輸出了

㈦ 我想用asp do while 語句 循環輸出sql 資料庫中的欄位內容 在子do while 里 還要輸出另外一個數據表的內容

因為你沒有嵌套使用,試試看下面這樣
<%
Dim zsql,csql,zRs,cRs
If ChannelID=113 Then
csql ="Select ClassID,ID,FolderName,TS,TN,TJ from KS_Class where TN='20119065171248'"
Set cRs = Conn.Execute(csql)
Do While not cRs.eof
response.write "<li>" & cRs("FolderName") & "</li>"
zsql ="Select KS_Fname,ID,KS_CID from KS_Form_zcfile where ID=" & cRS("ID") & "order by KS_CID"
Set zRs = Conn.Execute(zsql)
Do While not zRs.eof
response.write "<li>"&zRs("KS_Fname")&"</li>
zRs.movenext
loop
zRs.close
cRS.movenext
Loop
cRs.close
End If
%>

㈧ asp用sql如果把從表裡輸出的結果進行一些修改計算後再次排序顯示出來

簡單的可以在sql裡面完成如
數據表a中,有id,name,dj(單價),sl(數量)
現在要對金額(單價*數量)進行降序排序,可以是
"select
*
from
a
order
by
dj*sl
desc"
或者
select
*,(dj*sl)
as
je
from
a
order
by
je
desc"
第二種方法是將單價*數量的結果保存在一個臨時的欄位裡面,以上兩種方法可以實現對計算結果進行排序,但是不修改資料庫...^_^

㈨ 請教在ASP.NET怎麼輸出SQL查詢語句的值

SqlConnection conn=....
SqlCommand com=new SqlCommand( "select sum(空位數量) as total from House1 ",conn);
Lable1.Text=com.ExecuteScalar().ToString();

㈩ asp怎麼輸出sql查詢的某個欄位的總和

把結果集綁定到一個表示集合的控制項上 比如gridview,datagridview等然後在控制項上設置綁定到具體欄位 思路是這樣 具體的你還得看看文檔教程

熱點內容
交叉編譯優化 發布:2025-05-14 03:48:52 瀏覽:529
動圖在線壓縮 發布:2025-05-14 03:35:24 瀏覽:132
w7共享無法訪問 發布:2025-05-14 03:35:24 瀏覽:482
為什麼微信會出現賬號密碼錯誤 發布:2025-05-14 03:03:30 瀏覽:692
幻影腳本官網 發布:2025-05-14 03:01:13 瀏覽:826
servlet的webxml怎麼配置 發布:2025-05-14 02:51:46 瀏覽:772
怎麼取消手勢密碼 發布:2025-05-14 02:51:11 瀏覽:639
openvpn搭建vpn伺服器搭建 發布:2025-05-14 02:47:52 瀏覽:998
密碼忘了從哪裡找 發布:2025-05-14 02:39:09 瀏覽:548
我的世界什麼伺服器有前途 發布:2025-05-14 02:30:31 瀏覽:528