asp.net连接access数据库并显示数据

< %@Import Namespace= Namespace=System.Data.OleDb%>
<%@ImportNamespace=Namespace=System.Data%>
<%@PageLanguage="VB"ContentType="text/html"ResponseEncoding="gb2312"%>
<!DOCTYPEhtmlPUBLIC"-//W3C//DTDXHTML1.0Transitional//EN""http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<htmlxmlns="http://www.w3.org/1999/xhtml">
<head>
<metahttp-equiv="Content-Type"content="text/html;charset=gb2312"/>
<title>无标题文档</title>
<scriptlanguage="vb"runat="server">
DimconnAsOleDb.OleDbConnection
DimcommAsOleDbCommand
DimrsAsOleDb.OleDbdatareader

Subpage_load()subpage_load(senderasObject,easEventArgs)
conn
=NewOleDb.OleDbConnection("Provider=Microsoft.Jet.OLEDB.4.0;DataSource=e: etdbcs.mdb")
'conn=NewOleDb.OleDbConnection("Provider=Microsoft.ACE.oledb.12.0;Datasource=e: etdbcs.accdb")
conn.open()


comm
=NewOleDbCommand("select*fromuserlist",conn)
rs
=comm.Executereader()

dimshowcontasstring
dowhilers.read()
showcont
+=rs("username")&"----"&rs("tpnum")&"<br/>"
loop
show.innerHTML
=showcont

rs.close()
rs
=nothing
comm
=nothing
conn.close()
conn
=nothing
endsub



</script>
</head>
<body>
<spanid="show"runat="server"/>
</body>
</html>

你可能感兴趣的:(.net,asp.net,Access,asp,VB.NET)