📄 wbaodao.aspx.vb
字号:
Imports System.Data.SqlClient
Imports system.configuration
Imports System.Web.Configuration
Imports System.Data
Imports System.Drawing
Partial Class wbaodao
Inherits System.Web.UI.Page
Public pulic As New pulic1
Public Shared stats As String
'Public Shared ReadOnly Property UserInteractive() As Boolean
Protected Sub setFields()
'建立命令字段
GridView1.AutoGenerateColumns = False
Dim selectField As New CommandField()
selectField.ButtonType = ButtonType.Link
selectField.ShowSelectButton = True '显示选择按钮
selectField.SelectText = "选择"
selectField.HeaderText = "按钮"
selectField.ItemStyle.Wrap = False
'建立数据绑定字段
Dim employeeidField As New BoundField()
employeeidField.DataField = "nsrname" '指定数据来源字段
employeeidField.HeaderText = "纳税人名称" '设置字段头名称
'employeeidField.SortExpression = "nsrid" '指定排序字段名称
employeeidField.ItemStyle.Wrap = True
'employeeidField.ItemStyle.HorizontalAlign = HorizontalAlign.Center
'将字段加入到GridView
GridView1.Columns.Add(selectField)
GridView1.Columns.Add(employeeidField)
GridView1.DataBind()
End Sub
Protected Sub gviewEmployees_SelectedIndexChanging(ByVal sender As Object, ByVal e As System.Web.UI.WebControls.GridViewSelectEventArgs) Handles GridView1.SelectedIndexChanging
Session("name") = GridView1.Rows(e.NewSelectedIndex).Cells(1).Text
chuli()
End Sub
Protected Sub chuli()
System.Threading.Thread.Sleep(500)
Dim name As String = Session("name")
Dim cmd2 As New String("select nsrid from nsrinf where nsrname='" & name & "'")
Dim id As String = pulic.Scalar(cmd2)
Session("id") = id
Dim cmd3 As New String("select distinct nsrname as 纳税人名称,nsrid as 纳税人编号,skkid as 税控卡编号 from nsrinf where nsrid='" & id & "'")
Dim myReader As SqlDataReader = pulic.execute(cmd3)
While myReader.Read()
TextBox3.Text = (myReader.GetString(0))
TextBox4.Text = (myReader.GetString(1))
TextBox5.Text = (myReader.GetString(2))
End While
myReader.Close()
End Sub
Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
Response.Redirect("index.aspx")
End Sub
Protected Sub chushihua()
Label9.Visible = False
GridView1.SelectedRowStyle.Reset()
Session("grid2") = ""
Session("grid3") = ""
GridView1.DataSourceID = ""
' GridView1.DataSource = ""
TextBox3.Text = ""
TextBox4.Text = ""
TextBox5.Text = ""
End Sub
Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
If (Not IsPostBack) Then
setFields()
chushihua()
End If
End Sub
Protected Sub Button1_Click1(ByVal sender As Object, ByVal e As System.EventArgs)
chushihua()
Dim grid1 = ""
If Session("s") = "" Then
' nsrinf,shezhi,bd_rjy where shezhi.bd_jg<>'''+''' and nsrinf.nsrid=shezhi.nsrid and nsrinf.nsrid=bd_rjy.nsrid and bd_rjy.bdsign=0 and bd_rjy.rsign=0'
grid1 = "select distinct nsrinf.nsrname,nsrinf.nsrid from nsrinf,shezhi,bd_rjy where (nsrinf.nsrid=shezhi.nsrid) and (nsrinf.nsrid=bd_rjy.nsrid) and (bd_rjy.bdsign=0) and (bd_rjy.rsign=0) and (shezhi.bd_jg is not null )"
Else
grid1 = "select distinct nsrinf.nsrname,nsrinf.nsrid from nsrinf,shezhi,bd_rjy where (nsrinf.nsrid=shezhi.nsrid) and (nsrinf.nsrid=bd_rjy.nsrid) and (bd_rjy.bdsign=0) and (bd_rjy.rsign=0) and (shezhi.bd_jg is not null ) and " & Session("s")
End If
If TextBox1.Text <> "" Then
grid1 = grid1 + " and ( nsrinf.nsrname like '%" + TextBox1.Text().Trim + "%' )"
End If
If TextBox2.Text <> "" Then
grid1 = grid1 + " and (nsrinf.nsrid like '%" + TextBox2.Text().Trim + "%')"
End If
grid1 = grid1 + " order by nsrinf.nsrid"
System.Threading.Thread.Sleep(800)
Dim BAO As SqlDataReader = pulic.execute(grid1)
If BAO.HasRows Then
pulic.selectcommand(GridView1, sql1, grid1)
' GridView1.DataSource = BAO
GridView1.AllowSorting = True
GridView1.AllowPaging = True
GridView1.DataBind()
Else
Label9.Text = "提示:无匹配信息"
Label9.Visible = True
' MsgBox("演示警告对话框", MsgBoxStyle.Exclamation Or MsgBoxStyle.OkCancel Or MsgBoxStyle.DefaultButton1, "警告")
TextBox1.Text = ""
TextBox2.Text = ""
End If
BAO.Close()
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -