jieyue/jieyueadd.aspx.vb

(完整代码) 1KB

Imports System.Data

Partial Class jieyue_jieyueadd
    Inherits System.Web.UI.Page
    '借阅信息添加页面
    Dim id As String
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load

        If Not IsPostBack Then
            Dim id = Request.QueryString("id").ToString()
            Me.txtts.Text = id
            Me.txtyh.Text = Session("yhm")
            Me.txtjcsj.Text = Now
            Button1_Click(sender, e)
        End If
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        Dim yh As String = Me.txtyh.Text '用户

        Dim ts As String = Me.txtts.Text '图书

        Dim jcsj As String = Me.txtjcsj.Text '借出时间
        Dim ghsj As String = Me.txtjcsj.Text

        Dim zt As String = "在借" '状态

        Dim zzsj As String = "15" '最长时间

        Dim czr As String = Session("yhm") '操作人
        Dim sql As String = ""
        sql = "select count(*) as num from jieyue where (zt in ('在借','续借')) and yh='" + Session("yhm") + "'"
        Dim dtable As DataTable = New DataTable()
        Dim a As Integer = 0
        If dtable.Rows.Count > 0 Then
            a = dtable.Rows(0).Item("num")
        End If


        If (Integer.Parse(Session("jssl")) < Integer.Parse(a)) Then
            Response.Write("<script language='javascript'>alert('借阅数量已经出最大借阅数量');window.location.href='../tushu/tushu.aspx';</script>")

        Else

            sql = "insert into jieyue (yh,ts,jcsj,ghsj,zt,zzsj,czr ) values ('" + yh + "','" + ts + "','" + jcsj + "','" + ghsj + "','" + zt + "','" + zzsj + "','" + czr + "')"
            DBHelp.ExecuteNonQuery(sql, Nothing)
            sql = "update tushu set sl=sl-1 where tsid='" + ts + "'"
            DBHelp.ExecuteNonQuery(sql, Nothing)
            Response.Write("<script language='javascript'>alert('借阅信息添加成功');window.location.href='../tushu/tushu.aspx';</script>")
        End If



    End Sub
End Class

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读 AI

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。