jstovb.net的简单介绍( 二 )


asp:image id="Image1" style="Z-INDEX: 107; LEFT: 260px; POSITION: absolute; TOP: 180px" runat="server" Height="124px" Width="221px" ImageUrl="image/99re1-1.gif"/asp:image
asp:datagrid id="DataGrid1" style="Z-INDEX: 108; LEFT: 250px; POSITION: absolute; TOP: 83px" runat="server" Height="113px" Width="461px" BorderColor="#ffcc66" AutoGenerateColumns="False" HeaderStyle-Font-Size="9" HeaderStyle-HorizontalAlign="Center" HeaderStyle-ForeColor="red" HeaderStyle-Font-Bold="True"
Columns
asp:HyperLinkColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Height="24" ItemStyle-Font-Size="9" DataNavigateUrlField="stu_id" DataNavigateUrlFormatString="querry.aspx?stu_id={0}" DataTextField="stu_id" HeaderText="学号"/asp:HyperLinkColumn
asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="100" ItemStyle-Font-Size="9" DataField="tel" HeaderText="电话"/asp:BoundColumn
asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="80" ItemStyle-Font-Size="9" DataField="oicq" HeaderText="OICQ"/asp:BoundColumn
asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="140" ItemStyle-Font-Size="9" DataField="email" HeaderText="E-mail"/asp:BoundColumn
asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="60" ItemStyle-Font-Size="9" DataField="point" HeaderText="登录次数"/asp:BoundColumn
/Columns
/asp:datagrid
/form
/body
/HTML
下面是codebehind中的内容:boaman.asp.vb
Imports System.Data
Imports System.Data.SqlClient
Public Class boaman
Inherits System.Web.UI.Page
Protected WithEvents yourcheck As System.Web.UI.WebControls.CheckBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents CheckBoxList1 As System.Web.UI.WebControls.CheckBoxList
Protected WithEvents mycheck As System.Web.UI.WebControls.CheckBoxList
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
Protected WithEvents Image1 As System.Web.UI.WebControls.Image
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
#Region " Web Form Designer Generated Code "
'This call is required by the Web Form Designer.
System.Diagnostics.DebuggerStepThrough() Private Sub InitializeComponent()
End Sub
Private Sub Page_Init(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Init
'CODEGEN: This method call is required by the Web Form Designer
'Do not modify it using the code editor.
InitializeComponent()
End Sub
#End Region
Dim conn As SqlConnection = New SqlConnection("server=lixinri;uid=sa;pwd=;database=99re1")
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'////////////////////判断是否为过客
If Session("stu_id") = "" Then
Button1.Enabled = False : Button2.Enabled = False
'////////////////////调用check()事件
check()
Else
If Not IsPostBack Then
Dim sql As String = "select * from pwd where stu_id=@stu_id"
Dim comm As SqlCommand = New SqlCommand(sql, conn)
comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
comm.Parameters("@stu_id").Value = https://www.04ip.com/post/Session("stu_id")
Dim dr As SqlDataReader
conn.Open()
dr = comm.ExecuteReader
While dr.Read
If dr.Item("term") = "0" Then
'///////////////////判断是否为一般用户
dr.Close()
Button1.Enabled = False : Button2.Enabled = False
Dim sql_1 As String = "select a.stu_id as stu_id,a.term,b.name as name,b.tel as tel,b.call as oicq,b.point as point,b.email from pwd a,stu_base b where a.stu_id=b.stu_id"
Dim cmd As New SqlCommand(sql_1, conn)

推荐阅读