queryclientleaseform.aspx.vb

来自「与房地产相关的各项活动」· VB 代码 · 共 69 行

VB
69
字号
'文件名:QueryClientLeaseForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class ClientManage_QueryClientLeaseForm
    Inherits System.Web.UI.Page
    Private Shared MySQL As String = ""
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrintSQL() As String
        Get
            Return MySQL
        End Get
    End Property
    '设置要传递到打印页的数据
    Public ReadOnly Property MyPrintDate() As String
        Get
            Return "当前日期:" + DateTime.Now.ToShortDateString() + " 查询条件:所在城区:" + Me.DropDownList1.SelectedValue.ToString() + " 装修级别:" + Me.DropDownList2.SelectedValue.ToString() + " 房型:" + Me.TextBox4.Text + "房至" + Me.TextBox5.Text + "房 建筑面积:" + Me.TextBox6.Text + "至" + Me.TextBox7.Text + "m2 价格:" + Me.TextBox8.Text + "至" + Me.TextBox9.Text + "元"
        End Get
    End Property
    Protected Sub Page_Load(ByVal sender As Object, ByVal e As System.EventArgs) Handles Me.Load
        Dim MyForbidString As String = Session("MyForbid").ToString()
        If (MyForbidString.IndexOf("C4") > 1) Then
            Server.Transfer("~/SystemManage/AllErrorHelp.aspx")
        End If
        If (Not IsPostBack) Then
            Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHouseDBConnectionString").ConnectionString
            Dim MySQL As String = "Select * From 房源参数 Where 自编号='CQ001'"
            Dim MyConnection As New SqlConnection(MySQLConnectionString)
            MyConnection.Open()
            Dim MyHouseTable As New DataTable()
            Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection)
            MyAdapter.Fill(MyHouseTable)
            Dim MyName As String = "城区"
            Dim MyValue As String = MyHouseTable.Rows(0)(MyName).ToString()
            Dim MyPayData() As String = MyValue.Split("、")
            For Each MyString As String In MyPayData
                Me.DropDownList1.Items.Add(MyString)
            Next
            MyName = "装修"
            MyValue = MyHouseTable.Rows(0)(MyName).ToString()
            Dim MyDecData() As String = MyValue.Split("、")
            For Each MyString As String In MyDecData
                Me.DropDownList2.Items.Add(MyString)
            Next
            If (MyConnection.State = ConnectionState.Open) Then
                MyConnection.Close()
            End If
        End If
    End Sub
    Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
        '查询求租客源
        Dim MyQueryTable As New System.Data.DataTable()
        Dim MyConnection As New SqlConnection()
        MyConnection.ConnectionString = ConfigurationManager.ConnectionStrings("MyHouseDBConnectionString").ConnectionString
        MyConnection.Open()
        MySQL = "SELECT * FROM 求租客源视图 WHERE ('" + Me.TextBox1.Text + "' BETWEEN 委托日期 AND 截止日期) AND (所在城区='" + Me.DropDownList1.SelectedValue.ToString() + "') AND (装修级别='" + Me.DropDownList2.SelectedValue.ToString() + "') AND ( 最小房间数>=" + Me.TextBox4.Text + ") AND (最大房间数<=" + Me.TextBox5.Text + ") AND (最小面积>=" + Me.TextBox6.Text + ") AND (最大面积<=" + Me.TextBox7.Text + ") AND (最低租价>=" + Me.TextBox8.Text + ") AND (最高租价<=" + Me.TextBox9.Text + ")"
        Dim MyAdapter As New SqlDataAdapter(MySQL, MyConnection)
        MyAdapter.Fill(MyQueryTable)
        Me.GridView1.DataSource = MyQueryTable
        Me.GridView1.DataBind()
        If (MyConnection.State = ConnectionState.Open) Then
            MyConnection.Close()
        End If
    End Sub
    Protected Sub Button2_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button2.Click
        '打印求租客源
        Server.Transfer("~/ClientManage/QueryClientLeasePrint.aspx")
    End Sub
End Class

⌨️ 快捷键说明

复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?