温馨提示:代码在线浏览功能只能做为源码浏览参考,如果想更进一步了解该代码请下载:汽车配件公司网站(VB.net+Access数据库)源码
当前文件:
VbNetCompany/manager_class.aspx.vb,打开代码结构图
VbNetCompany/manager_class.aspx.vb,打开代码结构图1Imports System 2
Imports System.Data 3
Imports System.Configuration 4
Imports System.Collections 5
Imports System.Web 6
Imports System.Web.Security 7
Imports System.Web.UI 8
Imports System.Web.UI.WebControls 9
Imports System.Web.UI.WebControls.WebParts 10
Imports System.Web.UI.HtmlControls 11
Imports System.Data.OleDb 12
13
Public Partial Class manager_class 14
Inherits System.Web.UI.Page 15
Protected Sub Page_Load(ByVal sender As Object, ByVal e As EventArgs) 16
If Session("loginname") Is Nothing OrElse Session("loginname").ToString() = "" Then 17
Response.Write("<script>alert('用户登录时间超时,请重新登录');document.location='admin.aspx'</script>") 18
Response.[End]() 19
End If 20
End Sub 21
22
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As EventArgs) 23
Try 24
Using oleconn As New OleDbConnection() 25
oleconn.ConnectionString = ConfigurationManager.ConnectionStrings("oleConnectionString").ConnectionString 26
oleconn.Open() 27
28
Dim strSQL As String = "Insert INTO picclass(pic_class) Values('" + pic_class.Text + "')" 29
Dim command As New OleDbCommand(strSQL, oleconn) 30
command.ExecuteNonQuery() 31
32
oleconn.Close() 33
oleconn.Dispose() 34
Response.Write("<script language='javascript'>window.confirm('产品类别已经成功添加!!');</script>") 35
Response.Write("<script language='javascript'>parent.window.history.go(-1);</script>") 36
End Using 37
Catch err As Exception 38
Dim str As String = err.Message.Replace("'", "") 39
Response.Write("<script>alert('" + str + "');</script>") 40
End Try 41
End Sub 42
End Class






