1.propertieswndåviewçåºå«
2.100分求一个用VB.net做的简单网页的代码,谢谢!!!
propertieswndåviewçåºå«
顾åæä¹ï¼è§£å³æ¹æ¡çå«ä¹æ¯ä¸ç§å°ææç¨åºåå ¶å®èµæºï¼å®ä»¬æ¯æä¸ªå ·ä½çæ°æ®å¤çé®é¢ç解å³æ¹æ¡ï¼èéå°ä¸èµ·çæºå¶ãä¾å¦ï¼ç¨äºä¼ä¸ç»è¥çåå¸å¼è®¢åå½å ¥ç³»ç»å¯è½ç±è¥å¹²ä¸ªä¸åçç¨åºç»æï¼èå个ç¨åºæ¯ä½ä¸ºåä¸ä¸ªè§£å³æ¹æ¡å ç项ç®å¼åçï¼å æ¤ï¼è§£å³æ¹æ¡å°±æ¯åå¨ä¸ä¸ä¸ªæå¤ä¸ªé¡¹ç®æå ³çææä¿¡æ¯çæ件夹ï¼è¿æ ·å°±æä¸ä¸ªæå¤ä¸ªé¡¹ç®æ件夹æ¯è§£å³æ¹æ¡æ件夹çåæ件夹ãä¸è§£å³æ¹æ¡ä¸é¡¹ç®æå ³çä¿¡æ¯åå¨å¨æ©å±å为.slnå.suoç两个æ件ä¸ãå½å建æ个项ç®æ¶ï¼å¦æ没æéæ©å¨ç°æç解å³æ¹æ¡ä¸æ·»å 该项ç®ï¼é£ä¹ç³»ç»å°èªå¨å建ä¸ä¸ªæ°ç解å³æ¹æ¡ã
å½å建项ç®å解å³æ¹æ¡æ¶ï¼å¯ä»¥å¨åä¸ä¸ªè§£å³æ¹æ¡ä¸æ·»å æ´å¤ç项ç®ãæ们å¯ä»¥å¨ç°æç解å³æ¹æ¡ä¸æ·»å ä»»æç§ç±»ç项ç®ï¼ä½é常åªæ·»å ä¸è¯¥è§£å³æ¹æ¡å ç°æ项ç®ç¸å ³ç项ç®ãä¸è¬æ¥è¯´ï¼å个项ç®é½åºè¯¥æèªå·±ç解å³æ¹æ¡ï¼é¤éæ们æå¾å¥½ççç±ä¸è¿æ ·åã
VSå建项ç®æ¶ï¼é»è®¤ç项ç®æ件夹çå称ä¸é¡¹ç®å称ç¸åï¼è¯¥æ件夹è¿å°å®¹çº³ææ该项ç®å®ä¹çæ件ãå¦æä¸ä¿®æ¹çè¯ï¼è§£å³æ¹æ¡æä»¶å¤¹å ·æä¸é¡¹ç®æ件夹ç¸åçå称ï¼å ¶ä¸å å«äºé¡¹ç®æ件夹ãå®ä¹è§£å³æ¹æ¡å 容çæ件ã解å³æ¹æ¡æ件夹å å å«å¦ä¸å个æ件ï¼
æ©å±å为.slnçæ件ï¼è®°å½çå ³äºè§£å³æ¹æ¡ä¸é¡¹ç®çä¿¡æ¯ã
æ©å±å为.suoçæ件ï¼å ¶ä¸è®°å½çåºç¨äºè¯¥è§£å³æ¹æ¡çç¨æ·é项ã
æ©å±å为.sdfçæ件ï¼è®°å½çä¸è§£å³æ¹æ¡çIntellisenseæå ³çæ°æ®ãIntellisenseæ¯å¨Editorçªå£ä¸è¾å ¥ä»£ç æ¶æä¾èªå¨å®æåæ示åè½çå·¥å ·ã
æ©å±å为.opensdfçæ件ï¼è®°å½çå ³äºé¡¹ç®ç¶æçä¿¡æ¯ï¼æ¤æ件åªå¨é¡¹ç®å¤äºæå¼ç¶ææ¶ææã
项ç®æ件夹ä¸çReadme.txtæ件å å«å·²ç»ä¸ºè¯¥é¡¹ç®å建çæææ件çå 容æè¦ã
æ建项ç®æ¶å建çæ件ï¼
æ建项ç®å®æåå°çå°è§£å³æ¹æ¡æ件夹ä¸åºç°äºä¸ä¸ªæ°çåæ件夹Debugã该æ件夹å å«åææ建项ç®æ¶äº§ççè¾åºï¼è¿ä¸ªæ件夹å å«ä¸ä¸ªæ件ã
.exeæ件ï¼å¯æ§è¡æ件
.ilkæ件ï¼å¨éæ°æ建项ç®æ¶è¢«é¾æ¥å¨ä½¿ç¨ï¼å®ä½¿é¾æ¥å¨è½å¤æ ¹æ®ä¿®æ¹çæºä»£ç çæçç®æ æ件å¢éçé¾æ¥å°ç°æç.exeæ件ï¼ä»èé¿å æ¯æ¬¡ä¿®æ¹ç¨åºæ¶é½éæ°é¾æ¥æææ件ã
.pdbæ件ï¼å å«è°è¯ä¿¡æ¯ï¼å¨è°è¯æ¨¡å¼ä¸æ§è¡ç¨åºè¦ä½¿ç¨è¯¥è°è¯ä¿¡æ¯ãå¨è°è¯æ¨¡å¼ä¸ï¼å¯ä»¥å¨ææ£æ¥ç¨åºæ§è¡è¿ç¨ä¸æçæçä¿¡æ¯ã
å¨é¡¹ç®æ件夹ä¸ä¹æä¸ä¸ªDebugç®å½ï¼å®å å«å¨æ建è¿ç¨ä¸çæçå¾å¤æ件ï¼ä»Windows ExplorerçTypeæè¿°ä¸å¯ä»¥çå°å®ä»¬å å«ä½ç§ä¿¡æ¯ã
分求一个用VB.net做的简单网页的代码,谢谢!彩票统计源码!!
用vb.net做的校友录……(附所有源代码)
来源:不详 作者 佚名 点击数: 录入时间:-- ::
想必大家都上过校友录吧,里面的功能虽然不是很强大,但是为我们这些毕业之后各奔西东的学子来说,到真是提供了一个好的聚集点,下面是我用vb.net做的校友录,当然也不能说是校友录了,只能说是牛欢喜源码我们班的学友录了:)不过只要你掌握了这种编程思想,校友录就不在话下了。这里我将重点谈一下关于管理员权限赋予。
以前有这个想法的时候,难就难在管理员身份的赋予上,开始想如果一般用户在被提升为管理员之后,我可以把他的信息转到另外一个表中,以后登陆的源码没有图片时候先检查manage表中是否有他就行了,这种办法我已经实现了,是不是有些笨……可是正在我要正式开工的时候,一个想法突然冒了出来,是什么呢?呵呵,就是在数据库中再增加一个字段了如果是第一次注册就让这个字段item(int)的值为0,要是被提升之后就update为1,班级创始人呢?当然了,unity toggle 源码在他申请时付给他一个班级id,然后先判断班级id为这个已经注册的人信息条数是否为0,如果是,那么就付给他item=2好了。下面的代码中,我没有实现这个功能,因为我做的负整数源码是班友录的,当然了,我就是管理员喽:)
在这里,我使用的是checkboxlist(两个),一个用来转换数据(visibe=fause),一个用来显示数据,还有一个checkbox用来写全部选中的事件。当然了还有两个按钮事件,一个是用来提升为管理员的,一个是用来降级为一般用户的,这两个按钮在判断为一般用户时
enable都是为fause的,只有当判断登录为管理员时才为true。当然了,如果你是班级创始人,是不可能被降级的:)
这里用来显示信息的我用的是一个datagrid,当判断为非管理员时,删除栏的visible将为fause,为管理员的时候,才为true,也就是说只有管理员才可以删除信息。而不是注册的用户是不能发言的所有的按钮控件的enable将都为fause。
代码如下:board.aspx
<%@ Page Language="vb" AutoEventWireup="false" Codebehind="boaman.aspx.vb" Inherits="_re1.boaman"%>
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<HTML>
<HEAD>
<title></title>
<meta content="Microsoft Visual Studio.NET 7.0" name="GENERATOR">
<meta content="Visual Basic 7.0" name="CODE_LANGUAGE">
<meta content="javascript" name="vs_defaultClientScript">
<meta content="/intellisense/ie5" name="vs_targetSchema">
</HEAD>
<body background="image/bg.gif" MS_POSITIONING="GridLayout">
<form id="Form1" method="post" runat="server">
<asp:checkbox id="yourcheck" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" Text="全部选中" AutoPostBack="True" ForeColor="SaddleBrown" Font-Bold="True"></asp:checkbox>
<asp:button id="Button1" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" Text="提升为管理员" Height="px" Width="px" BackColor="Gainsboro" BorderColor="Lavender" BorderWidth="2px" BorderStyle="Outset"></asp:button>
<asp:button id="Button2" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" Text="降级为一般用户" Height="px" Width="px" BackColor="Gainsboro" BorderColor="Lavender" BorderWidth="2px" BorderStyle="Outset"></asp:button>
<asp:checkboxlist id="CheckBoxList1" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" Visible="False"></asp:checkboxlist>
<asp:checkboxlist id="mycheck" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" ForeColor="Navy" Font-Size="X-Small"></asp:checkboxlist>
<asp:label id="Label1" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" ForeColor="Red" Font-Names="方正姚体">(已注册用户)</asp:label>
<asp:image id="Image1" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" Height="px" Width="px" ImageUrl="image/re1-1.gif"></asp:image>
<asp:datagrid id="DataGrid1" style="Z-INDEX: ; LEFT: px; POSITION: absolute; TOP: px" runat="server" Height="px" Width="px" BorderColor="#ffcc" 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="" 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="" ItemStyle-Font-Size="9" DataField="tel" HeaderText="电话"></asp:BoundColumn>
<asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="" ItemStyle-Font-Size="9" DataField="oicq" HeaderText="OICQ"></asp:BoundColumn>
<asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="" ItemStyle-Font-Size="9" DataField="email" HeaderText="E-mail"></asp:BoundColumn>
<asp:BoundColumn ItemStyle-ForeColor="navy" ItemStyle-HorizontalAlign="Center" ItemStyle-Width="" 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=re1")
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 = 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)
dr = cmd.ExecuteReader
While dr.Read
If dr.Item("term") = "1" Then
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>" & "<font color=darkorange>(管理员)</font>")
ElseIf dr.Item("term") = "2" Then
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>" & "<font color=red>(班级创始人)<font>")
Else
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>")
End If
CheckBoxList1.Items.Add(dr.Item("stu_id"))
End While
Else
'////////////////////判断是否为管理员
dr.Close()
Button1.Enabled = True : Button2.Enabled = True
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)
dr = cmd.ExecuteReader
While dr.Read
If dr.Item("term") = "1" Then
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>" & "<font color=darkorange>(管理员)</font>")
ElseIf dr.Item("term") = "2" Then
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>" & "<font color=red>(班级创始人)<font>")
Else
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>")
End If
CheckBoxList1.Items.Add(dr.Item("stu_id"))
End While
End If
End While
dr.Close()
'////////////////////////取出数据,填充dataset
Dim mysql 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"
comm = New SqlCommand(mysql, conn)
Dim mycomm As SqlDataAdapter = New SqlDataAdapter(mysql, conn)
Dim ds As DataSet = New DataSet()
mycomm.Fill(ds, "base")
DataGrid1.DataSource = ds.Tables("base").DefaultView
DataGrid1.DataBind()
End If
End If
End Sub
'///////////////////////书写check()事件
Sub check()
If Not IsPostBack Then
Dim mysql 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 comm As New SqlCommand(mysql, conn)
Dim dr As SqlDataReader
conn.Open()
dr = comm.ExecuteReader
While dr.Read
If dr.Item("term") = "1" Then
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>" & "<font color=darkorange>(管理员)</font>")
ElseIf dr.Item("term") = "2" Then
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>" & "<font color=red>(班级创始人)<font>")
Else
mycheck.Items.Add("<u>" & dr.Item("name") & "</u>")
End If
CheckBoxList1.Items.Add(dr.Item("stu_id"))
End While
dr.Close()
Dim mycomm As SqlDataAdapter = New SqlDataAdapter(mysql, conn)
Dim ds As DataSet = New DataSet()
mycomm.Fill(ds, "base")
DataGrid1.DataSource = ds.Tables("base").DefaultView
DataGrid1.DataBind()
End If
End Sub
'/////////////////////填充yourcheck
Private Sub yourcheck_CheckedChanged(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles yourcheck.CheckedChanged
Dim i As Integer
For i = 0 To mycheck.Items.Count - 1
If yourcheck.Checked Then
mycheck.Items(i).Selected = True
Else
mycheck.Items(i).Selected = False
End If
Next
End Sub
'///////////////////////提升一般用户为管理员
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
conn.Open()
Dim i As Integer
For i = 0 To mycheck.Items.Count - 1
If mycheck.Items(i).Selected Then
Dim sql_1 As String = "update pwd set term=1 where stu_id=@stu_id and term=0"
Dim comm As SqlCommand = New SqlCommand(sql_1, conn)
comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
comm.Parameters("@stu_id").Value = CheckBoxList1.Items(i).Text
comm.ExecuteNonQuery()
End If
Next
Response.Redirect("boaman.aspx")
End Sub
'///////////////////////降级管理员为一般用户
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
conn.Open()
Dim i As Integer
For i = 0 To mycheck.Items.Count - 1
If mycheck.Items(i).Selected Then
Dim sql_1 As String = "update pwd set term=0 where stu_id=@stu_id and term=1"
Dim comm As SqlCommand = New SqlCommand(sql_1, conn)
comm.Parameters.Add(New SqlParameter("@stu_id", SqlDbType.Int, 4))
comm.Parameters("@stu_id").Value = CheckBoxList1.Items(i).Text
comm.ExecuteNonQuery()
End If
Next
Response.Redirect("boaman.aspx")
End Sub
End Class
当然了,这里面还有好多不足的地方,恳求高手批评指正。
校友录还有一些其它的功能就很简单了,这里就不再探讨了。