ASP访问数据库并插入到html 怎么实现 50
======test.aspx.vb=========ImportsSystem.Data.SqlClientPartialPublicClassindex....Pro...
======test.aspx.vb=========
Imports System.Data.SqlClient
Partial Public Class index
....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cn = New SqlConnection("Data Source =localhost;Initial Catalog = KEYLOGUAT; Integrated Security =true;")
cn.Open()
da = New SqlDataAdapter("select ...", cn)
ds = New DataSet()
da.Fill(ds, "ActivityLog")
cn.Close()
End Sub
======test.aspx.vb=========
=========test.aspx============
<div id="logtable_row">
<div id="logtable_cell_label_text">
<%=ds.Tables(0).Rows(0).Item(0).ToString()%>
</div>
</div>
=========test.aspx============
以上代码<%=ds.Tables(0).Rows(0).Item(0).ToString()%>有值出现在浏览器的。系统要求,要改成Html + .asp实现
想在asp读取数据库,取值,并根据script找到html对应的标签替换回去。怎么没法显示值。哪里有问题,求高手解答。谢谢。
=========test.html============
<script.....>
$(document).ready(fuction(){
$(#"logtable_row").load("./Test.asp");
};
....
</script>
<div id="logtable_row">
...
</div>
=========test.html============
=========test.asp============
<div id="logtable_cell_label_text">
<%=ds.Tables(0).Rows(0).Item(0).ToString()%>
</div>
<%
set cn = New SqlConnection("Data Source =localhost;Initial Catalog = KEYLOGUAT; Integrated Security =true;")
cn.Open()
set da = New SqlDataAdapter("select ...", cn)
set ds = New DataSet()
da.Fill(ds, "ActivityLog")
cn.Close()
%>
=========test.asp============ 展开
Imports System.Data.SqlClient
Partial Public Class index
....
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
cn = New SqlConnection("Data Source =localhost;Initial Catalog = KEYLOGUAT; Integrated Security =true;")
cn.Open()
da = New SqlDataAdapter("select ...", cn)
ds = New DataSet()
da.Fill(ds, "ActivityLog")
cn.Close()
End Sub
======test.aspx.vb=========
=========test.aspx============
<div id="logtable_row">
<div id="logtable_cell_label_text">
<%=ds.Tables(0).Rows(0).Item(0).ToString()%>
</div>
</div>
=========test.aspx============
以上代码<%=ds.Tables(0).Rows(0).Item(0).ToString()%>有值出现在浏览器的。系统要求,要改成Html + .asp实现
想在asp读取数据库,取值,并根据script找到html对应的标签替换回去。怎么没法显示值。哪里有问题,求高手解答。谢谢。
=========test.html============
<script.....>
$(document).ready(fuction(){
$(#"logtable_row").load("./Test.asp");
};
....
</script>
<div id="logtable_row">
...
</div>
=========test.html============
=========test.asp============
<div id="logtable_cell_label_text">
<%=ds.Tables(0).Rows(0).Item(0).ToString()%>
</div>
<%
set cn = New SqlConnection("Data Source =localhost;Initial Catalog = KEYLOGUAT; Integrated Security =true;")
cn.Open()
set da = New SqlDataAdapter("select ...", cn)
set ds = New DataSet()
da.Fill(ds, "ActivityLog")
cn.Close()
%>
=========test.asp============ 展开
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询