parameterform.aspx.vb
来自「与房地产相关的各项活动」· VB 代码 · 共 87 行
VB
87 行
'文件名:ParameterForm.aspx.vb
Imports System.Data.SqlClient
Imports System.Data
Partial Class CompanyManage_ParameterForm
Inherits System.Web.UI.Page
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("A1") > 1) Then
Server.Transfer("~/SystemManage/AllErrorHelp.aspx")
End If
Me.Button1.OnClientClick = "return confirm('请检查房源参数值是否正确并符合规范,否则保存后发生意外的结果!是否继续?')"
Me.Button2.OnClientClick = "return confirm('请检查其他参数值是否正确并符合规范,否则保存后发生意外的结果!是否继续?')"
End Sub
Protected Sub DropDownList1_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList1.SelectedIndexChanged
'显示房源参数值
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 = Me.DropDownList1.SelectedValue.ToString()
Dim MyValue As String = MyHouseTable.Rows(0)(MyName).ToString()
Dim MyData() As String = MyValue.Split("、")
Me.TextBox1.Text = ""
For Each MyLine As String In MyData
If (MyLine.Length > 0) Then
Me.TextBox1.Text += MyLine + "、"
End If
Next
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
End Sub
Protected Sub Button1_Click(ByVal sender As Object, ByVal e As System.EventArgs) Handles Button1.Click
'新增房源参数值
Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHouseDBConnectionString").ConnectionString
Dim MyConnection As New SqlConnection(MySQLConnectionString)
MyConnection.Open()
Dim MyName As String = Me.DropDownList1.SelectedValue.ToString()
Dim MyValue As String = Me.TextBox1.Text
Dim MySQL As String = "Update 房源参数 Set " + MyName + "='" + MyValue + "' Where 自编号='CQ001'"
Dim MyCommand As New SqlCommand(MySQL, MyConnection)
MyCommand.ExecuteNonQuery()
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
End Sub
Protected Sub DropDownList2_SelectedIndexChanged(ByVal sender As Object, ByVal e As System.EventArgs) Handles DropDownList2.SelectedIndexChanged
'显示其他参数值
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 = Me.DropDownList2.SelectedValue.ToString()
Dim MyValue As String = MyHouseTable.Rows(0)(MyName).ToString()
Dim MyData() As String = MyValue.Split("、")
Me.TextBox2.Text = ""
For Each MyLine As String In MyData
If (MyLine.Length > 0) Then
Me.TextBox2.Text += MyLine + "、"
End If
Next
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
'新增其他参数值
Dim MySQLConnectionString As String = ConfigurationManager.ConnectionStrings("MyHouseDBConnectionString").ConnectionString
Dim MyConnection As New SqlConnection(MySQLConnectionString)
MyConnection.Open()
Dim MyName As String = Me.DropDownList2.SelectedValue.ToString()
Dim MyValue As String = Me.TextBox2.Text
Dim MySQL As String = "Update 其他参数 Set " + MyName + "='" + MyValue + "' Where 自编号='CQ001'"
Dim MyCommand As New SqlCommand(MySQL, MyConnection)
MyCommand.ExecuteNonQuery()
If (MyConnection.State = ConnectionState.Open) Then
MyConnection.Close()
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?