news.asp
<%
set rs server.createobject("adodb.recordset")
sql="select * from neixun order by id desc"
rs.open sql ,conn,1,3
%>
新闻:
<% do while not rs.eof %>
<a href =neixun.asp?id=<% = rs("id") %>><% = trim(rs("title")) %>
<%
rs.movenext
loop
%>
neixun.asp
<%
id=request.querystring("id")
set rs=server.createobject("adodb.recordset")
sql="select * from neixun where id="&id
rs.open sql,conn,1,3
%>
新闻标题:<% = rs("title") %>
新闻内容:<% = rs("news" ) %>
自定义列
1.
<asp:templatecolumn headertext="新闻动态" sortexpression="sitename">
<itemtemplate>
<asp:hyperlink text='<%#container.dataitem("newtitle")%>' navigateurl='<%#"news.aspx?link_id="&container.dataitem(link_id)%>' target="_blank" runat="server">
</itemtemplate>
</asp:templatecolumn>
2.
news.aspx
dim strsql as string
strsql="select * from link where link_id="&request.querystring("link_id")
dim cmd as new oledbcommand ( strsql,conn)
conn.open
dim dr as oledbdatareader=cmd.executereader()
dr.read()
message.text&= "新闻标题:"&dr.item("newtitle")
message.text&="<br>新闻内容:"&dr.item("news")
conn.close()
NET用户系统
dim conn as string
conn=configurationsettings.appsettings("strconn")
dim strsql as string
strsql="selct * from users where username='"&username.text&"' and mypassword = '"&password.text&"' "
dim cmd as newoledbcommand(strsql,conn)
conn.open( )
dim dr as oledbdatareader=cmd.executereader( )
if dr.read( )=ture then
conn.close( )
formsauthentication.redirectformloginpage(username.text,ture)
else
conn.close( )
respose.write(" 您的用户名或密码错误了")
end if