📄 queryaccessnum.aspx.vb
字号:
Imports System.Data
Imports System.Data.OleDb
Public Class queryAccessNum
Inherits System.Web.UI.Page
Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents Label2 As System.Web.UI.WebControls.Label
Protected WithEvents Label3 As System.Web.UI.WebControls.Label
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents DataGrid1 As System.Web.UI.WebControls.DataGrid
Protected WithEvents Button2 As System.Web.UI.WebControls.Button
Protected WithEvents Label1 As System.Web.UI.WebControls.Label
#Region " Web 窗体设计器生成的代码 "
'该调用是 Web 窗体设计器所必需的。
<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: 此方法调用是 Web 窗体设计器所必需的
'不要使用代码编辑器修改它。
InitializeComponent()
End Sub
#End Region
Private Sub Page_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
'在此处放置初始化页的用户代码
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox1.Text = "" Then
Response.Write("<script language=vbscript>alert ""不能用空信息进行查询!""</script>")
Exit Sub
ElseIf Not IsNumeric(TextBox1.Text) Then
Response.Write("<script language=vbscript>alert ""请输入数字进行查询!""</script>")
Exit Sub
End If
Dim mycon As New OleDbConnection()
Dim myds As New DataSet()
mycon.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & Server.MapPath("OnLineSale.mdb")
mycon.Open()
Dim sqlstr
If DropDownList1.SelectedIndex = 0 Then
sqlstr = "select * from goods where gAccessNum < " & TextBox1.Text
Else
sqlstr = "select * from goods where gType='" & DropDownList1.Items(DropDownList1.SelectedIndex).Value & _
"' and gAccessNum < " & TextBox1.Text
End If
Session("sqlstr") = sqlstr
Dim myadpt As OleDbDataAdapter = New OleDbDataAdapter(sqlstr, mycon)
myadpt.Fill(myds, "table1")
DataGrid1.DataSource = myds.Tables("table1").DefaultView
DataGrid1.DataBind()
mycon.Close()
mycon = Nothing
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
Response.Redirect("managerOption.aspx")
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -