【正文】
:清華大學(xué)出版社【10】 【11】 :清華大學(xué)出版社【12】 【13】 【14】 :清華大學(xué)出版社【15】 :人民郵電出版社附錄(1)登陸頁面主要代碼Protected Sub ImageButton1_Click1(ByVal sender As Object, ByVal e As ) Handles Dim sqlconnstr As String = (ConnectionString).ConnectionString Dim sqlconn As SqlConnection = New SqlConnection(sqlconnstr) () Dim sqlmand As SqlCommand = New SqlCommand(select * from admin where 用戶名=39。and 密碼=39。and 用戶類型=39。, sqlconn) Dim count As String = () Session(usestatues) = Session(username) = If count Nothing And Session(usestatues) = 管理員 Then () ElseIf count Nothing And Session(usestatues) = 教師 Then () ElseIf count Nothing And Session(usestatues) = 學(xué)生 Then () Else = End If End Sub(2)查看學(xué)生成績(jī)主要代碼: Protected Sub Button1_Click(ByVal sender As Object, ByVal e As ) Handles Dim sqlconnstr As String = (ConnectionString).ConnectionString Dim sqlconn As SqlConnection = New SqlConnection(sqlconnstr) Dim ds As DataSet = New DataSet() () Dim sqld As SqlDataAdapter = New SqlDataAdapter(select * from 成績(jī)表 where 學(xué)號(hào)=39。, sqlconn) (ds, tabgrade) = (tabgrade).DefaultView () () sqlconn = NothingEnd Sub(3)修改密碼主要代碼:Protected Sub Button1_Click(ByVal sender As Object, ByVal e As ) Handles Dim intupdatecount As Integer Dim sqlconnstr As String = (ConnectionString).ConnectionString Dim sqlconn As SqlConnection = New SqlConnection(sqlconnstr) Dim sqlmand As SqlCommand = New SqlCommand() = sqlconn = update admin set 密碼=密碼 where 用戶名=39。and 用戶類型= 39。 (密碼, ) Try () intupdatecount = If (intupdatecount 0) Then = 修改成功! Else = 修改失?。? End If Catch ex As Exception = 錯(cuò)誤原因: + Finally sqlmand = Nothing () sqlconn = Nothing End Try End Sub Protected Sub Page_Load(ByVal sender As Object, ByVal e As ) Handles Dim username As String Dim yonghul As String username = Session(username) yonghul = Session(usestatues) = yonghul = username End Sub(4)教師對(duì)學(xué)生成績(jī)的添加主要代碼:Protected Sub Button2_Click(ByVal sender As Object, ByVal e As ) Handles Dim sqlconnstr As String = (ConnectionString).ConnectionString Dim sqlconn As SqlConnection = New SqlConnection(sqlconnstr) 39。把SQL語句賦給Command對(duì)象 = insert into 成績(jī)表(學(xué)號(hào),姓名,課程名,考核方式,學(xué)期,成績(jī)) values (學(xué)號(hào),姓名,課程名,考核方式,學(xué)期,成績(jī)) (學(xué)號(hào), ) (姓名, ) (課程名, ) (考核方式, ) (學(xué)期, ) (成績(jī), ) Try 39。執(zhí)行SQL命令 () = 恭喜您!添加成功! = = = = 考試 = 1 Catch ex As Exception = 對(duì)不起!添加失?。? = = = = 考試 = 1 Finally sqlmand = Nothing () sqlconn = Nothing End Try End S