代码生成机器

Imports System.Data.SqlClient
Public Class data
Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents DropDownList2 As System.Web.UI.WebControls.DropDownList
Protected WithEvents CheckBoxList1 As System.Web.UI.WebControls.CheckBoxList
Protected WithEvents TextBox4 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button2 As System.Web.UI.WebControls.Button

'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object

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
'在此处放置初始化页的用户代码
If Not Page.IsPostBack Then
PageInit()
End If

End Sub
Public Sub PageInit()
'Dim conn As SqlConnection = New SqlConnection
'conn.ConnectionString = "initial catalog=ysnew;data source=;user id=sa;password="
'Dim cmd As SqlCommand = New SqlCommand
'cmd.Connection = conn
'cmd.CommandText = "select * from snht"
Dim dt As DataTable = Cls_common.ExecQuerySQL("select * from sn_ht")
For Each dc As DataColumn In dt.Columns
Dim li As ListItem = New ListItem(dc.ColumnName, dc.ColumnName)
li.Selected = True
Me.CheckBoxList1.Items.Add(li)
Next
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
'' Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("insert into gm_ht(")
'Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("")
'Dim i As Integer = 0
'Dim j As Integer = 0
'For Each li As ListItem In Me.CheckBoxList1.Items
' If li.Selected Then
' i = i + 1
' If i <> 1 Then sb.Append("\r\n")
' For k As Integer = 0 To 1
' If k = 0 Then
' sb.Append("cmd.Parameters.Add123New SqlParameter123456@" & li.Text)
' Else
' sb.Append("456," & li.Text & "222Text333333")
' End If

' Next


' End If
'Next
'Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("")
'Dim i As Integer = 0
'Dim j As Integer = 0
'For Each li As ListItem In Me.CheckBoxList1.Items
' If li.Selected Then
' i = i + 1
' If i <> 1 Then sb.Append("\n")
' For k As Integer = 0 To 1
' If k = 0 Then
' sb.Append(li.Text & ".Text = Convert.ToString123drtemp123456")
' Else
' sb.Append(li.Text & "456789789")
' End If

' Next


' End If
'Next
Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("update sn_ht set ")
Dim i As Integer = 0
Dim j As Integer = 0
For Each li As ListItem In Me.CheckBoxList1.Items
If li.Selected Then
i = i + 1
If i <> 1 Then sb.Append(",")
For k As Integer = 0 To 1
If k = 0 Then
sb.Append(li.Text & "=")
Else
sb.Append("@" & li.Text)
End If

Next


End If
Next

''Dim i As Integer = 0
''Dim j As Integer = 0
''For Each li As ListItem In Me.CheckBoxList1.Items
'' If li.Selected Then
'' i = i + 1
'' If i <> 1 Then sb.Append(",")

'' sb.Append(li.Text)
'' End If
''Next
''sb.Append(")")
''sb.Append(" values(")
''For Each li As ListItem In Me.CheckBoxList1.Items
'' If li.Selected Then
'' j = j + 1
'' If j <> 1 Then sb.Append(",")
'' sb.Append("@" + li.Text)
'' End If
''Next
''sb.Append(")")
Me.TextBox4.Text = sb.ToString()
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter("c:\ee.txt")
sw.Write(sb.ToString)
sw.Flush()
sw.Close()

End Sub
End Class

Imports System.Data.SqlClient
Public Class data
Inherits System.Web.UI.Page

#Region " Web 窗体设计器生成的代码 "

'该调用是 Web 窗体设计器所必需的。
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()

End Sub
Protected WithEvents TextBox1 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox2 As System.Web.UI.WebControls.TextBox
Protected WithEvents TextBox3 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button1 As System.Web.UI.WebControls.Button
Protected WithEvents DropDownList1 As System.Web.UI.WebControls.DropDownList
Protected WithEvents DropDownList2 As System.Web.UI.WebControls.DropDownList
Protected WithEvents CheckBoxList1 As System.Web.UI.WebControls.CheckBoxList
Protected WithEvents TextBox4 As System.Web.UI.WebControls.TextBox
Protected WithEvents Button2 As System.Web.UI.WebControls.Button

'注意: 以下占位符声明是 Web 窗体设计器所必需的。
'不要删除或移动它。
Private designerPlaceholderDeclaration As System.Object

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
'在此处放置初始化页的用户代码
If Not Page.IsPostBack Then
PageInit()
End If

End Sub
Public Sub PageInit()
'Dim conn As SqlConnection = New SqlConnection
'conn.ConnectionString = "initial catalog=ysnew;data source=;user id=sa;password="
'Dim cmd As SqlCommand = New SqlCommand
'cmd.Connection = conn
'cmd.CommandText = "select * from snht"
Dim dt As DataTable = Cls_common.ExecQuerySQL("select * from gm_ht")
For Each dc As DataColumn In dt.Columns
Dim li As ListItem = New ListItem(dc.ColumnName, dc.ColumnName)
li.Selected = True
Me.CheckBoxList1.Items.Add(li)
Next
End Sub


Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
'cmd.Parameters.Add(New SqlParameter("@txtbh", txtbh.Text))
'' Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("insert into gm_ht(")
'Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("")
'Dim i As Integer = 0
'Dim j As Integer = 0
'For Each li As ListItem In Me.CheckBoxList1.Items
' If li.Selected Then
' i = i + 1
' If i <> 1 Then sb.Append("\r\n")
' For k As Integer = 0 To 1
' If k = 0 Then
' sb.Append("cmd.Parameters.Add(New SqlParameter(""@" & li.Text)
' Else
' sb.Append("""," & li.Text & ".Text))")
' End If

' Next


' End If
'Next
Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("")
Dim i As Integer = 0
Dim j As Integer = 0
For Each li As ListItem In Me.CheckBoxList1.Items
If li.Selected Then
i = i + 1
If i <> 1 Then sb.Append("\t")
For k As Integer = 0 To 1
If k = 0 Then
sb.Append(li.Text & ".Text = Convert.ToString(drtemp(""")
Else
sb.Append(li.Text & """))")
End If

Next


End If
Next
'Dim sb As System.Text.StringBuilder = New System.Text.StringBuilder("update la_ht set ")
'Dim i As Integer = 0
'Dim j As Integer = 0
'For Each li As ListItem In Me.CheckBoxList1.Items
' If li.Selected Then
' i = i + 1
' If i <> 1 Then sb.Append(",")
' For k As Integer = 0 To 1
' If k = 0 Then
' sb.Append(li.Text & "=")
' Else
' sb.Append("@" & li.Text)
' End If

' Next


' End If
'Next

''Dim i As Integer = 0
''Dim j As Integer = 0
''For Each li As ListItem In Me.CheckBoxList1.Items
'' If li.Selected Then
'' i = i + 1
'' If i <> 1 Then sb.Append(",")

'' sb.Append(li.Text)
'' End If
''Next
''sb.Append(")")
''sb.Append(" values(")
''For Each li As ListItem In Me.CheckBoxList1.Items
'' If li.Selected Then
'' j = j + 1
'' If j <> 1 Then sb.Append(",")
'' sb.Append("@" + li.Text)
'' End If
''Next
''sb.Append(")")
Me.TextBox4.Text = sb.ToString()
Dim sw As System.IO.StreamWriter = New System.IO.StreamWriter("c:\ee.txt")
sw.Write(sb.ToString)
sw.Flush()
sw.Close()

End Sub
End Class

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值