📄 transfer.vb
字号:
'
'TextBox3
'
Me.TextBox3.BorderStyle = System.Windows.Forms.BorderStyle.FixedSingle
Me.TextBox3.Location = New System.Drawing.Point(296, 32)
Me.TextBox3.Name = "TextBox3"
Me.TextBox3.Size = New System.Drawing.Size(104, 21)
Me.TextBox3.TabIndex = 1
Me.TextBox3.Text = ""
'
'Label7
'
Me.Label7.Location = New System.Drawing.Point(208, 32)
Me.Label7.Name = "Label7"
Me.Label7.Size = New System.Drawing.Size(72, 23)
Me.Label7.TabIndex = 0
Me.Label7.Text = "资产名称:"
'
'Transfer
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(568, 334)
Me.Controls.Add(Me.GroupBox1)
Me.Controls.Add(Me.TextBox2)
Me.Controls.Add(Me.Button3)
Me.Controls.Add(Me.Button2)
Me.Controls.Add(Me.Button1)
Me.Controls.Add(Me.TextBox1)
Me.Controls.Add(Me.Label6)
Me.Controls.Add(Me.ComboBox3)
Me.Controls.Add(Me.Label5)
Me.Controls.Add(Me.DateTimePicker1)
Me.Controls.Add(Me.Label4)
Me.Controls.Add(Me.ComboBox2)
Me.Controls.Add(Me.Label3)
Me.Controls.Add(Me.Label2)
Me.Controls.Add(Me.Label1)
Me.MaximizeBox = False
Me.Name = "Transfer"
Me.Text = "-----------资产转移"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
Close()
End Sub
Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
MsgBox(c1)
MsgBox(c2)
End Sub
Private Sub Transfer_Load(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles MyBase.Load
TextBox3.Text = node2
TextBox4.Text = node1
'Departement()
For Each DepartementRow In DepartementDataSet.Tables("T_DEPARTMENT").Rows
Me.ComboBox2.Items.Add(DepartementRow("TYPE_NAME"))
Next
Me.ComboBox2.Text = Me.ComboBox2.Items(0)
'Assent()
For Each assentRow In assentDataSet.Tables("T_ASSET_MAIN").Rows
Me.ComboBox3.Items.Add(assentRow("ADD_REN"))
Next
Me.ComboBox3.Text = Me.ComboBox3.Items(0)
Button2.Text = "更新"
TextBox2.Text = node3
End Sub
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
If TextBox2.Text <> ComboBox2.Text Then
MsgBox("确定转移吗?")
Try
myConnStr = connstr()
myConnetion = New SqlConnection(myConnStr)
myConnetion.Open()
mySql = "insert into T_TRANSFER values(@c1,@c2,@c3,@c4,@c5,@c6,@c7)"
myCommand = New SqlCommand(mySql, myConnetion)
myCommand.Parameters.Add(New SqlParameter("@c1", SqlDbType.VarChar, 6))
myCommand.Parameters("@c1").Value = node1
myCommand.Parameters.Add(New SqlParameter("@c2", SqlDbType.VarChar, 6))
myCommand.Parameters("@c2").Value = TextBox3.Text
myCommand.Parameters.Add(New SqlParameter("@c3", SqlDbType.VarChar, 20))
myCommand.Parameters("@c3").Value = TextBox2.Text
myCommand.Parameters.Add(New SqlParameter("@c4", SqlDbType.VarChar, 20))
myCommand.Parameters("@c4").Value = ComboBox2.Text
myCommand.Parameters.Add(New SqlParameter("@c5", SqlDbType.DateTime))
myCommand.Parameters("@c5").Value = CDate(DateTimePicker1.Text)
myCommand.Parameters.Add(New SqlParameter("@c6", SqlDbType.VarChar, 10))
myCommand.Parameters("@c6").Value = ComboBox3.Text
myCommand.Parameters.Add(New SqlParameter("@c7", SqlDbType.VarChar, 200))
myCommand.Parameters("@c7").Value = TextBox1.Text
myCommand.ExecuteNonQuery()
myConnetion.Close()
myConnetion.Open()
myCommand = New SqlCommand("UPDATE T_ASSET_MAIN SET ASSET_TYPE = @ASSET_TYPE " & _
"WHERE ASSET_CODE = @ASSET_CODE", myConnetion)
myCommand.Parameters.Add("@ASSET_CODE", SqlDbType.VarChar, 6, "ASSET_CODE")
myCommand.Parameters("@ASSET_CODE").Value = node1
myCommand.Parameters.Add("@ASSET_TYPE", SqlDbType.VarChar, 1, "ASSET_TYPE")
myCommand.Parameters("@ASSET_TYPE").Value = 4
myDataAdapter.UpdateCommand = myCommand
myCommand.ExecuteNonQuery()
myConnetion.Close()
'MsgBox("close")
myCommand = New SqlClient.SqlCommand("PR_T_ASSET_MAIN", myConnetion)
myCommand.CommandType = CommandType.StoredProcedure
'comm.CommandText = "PR_T_ASSET_MAIN"
Dim v1, v2 As String
v1 = Mid(node1, 1, 1)
v2 = Mid(node2, 1, 1)
Dim myparameter As SqlClient.SqlParameter
myparameter = myCommand.Parameters.Add("@TYPE", SqlDbType.VarChar, 1)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = v1
myparameter = myCommand.Parameters.Add("@DEPARTMENT", SqlDbType.VarChar, 1)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = v2
myparameter = myCommand.Parameters.Add("@ASSET_NAME", SqlDbType.VarChar, 20)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node2
myparameter = myCommand.Parameters.Add("@USE_DEP", SqlDbType.VarChar, 20)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = ComboBox2.Text
myparameter = myCommand.Parameters.Add("@BUY_TIME", SqlDbType.DateTime)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node4
myparameter = myCommand.Parameters.Add("@ASSENT_QUANTITY", SqlDbType.Int)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node5
myparameter = myCommand.Parameters.Add("@ASSENT_PRICE", SqlDbType.Money)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node6
myparameter = myCommand.Parameters.Add("@BUY_MAN", SqlDbType.VarChar, 10)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node7
myparameter = myCommand.Parameters.Add("@BURDEN_MAN", SqlDbType.VarChar, 10)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node8
myparameter = myCommand.Parameters.Add("@USE_MAN", SqlDbType.VarChar, 10)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node9
myparameter = myCommand.Parameters.Add("@ADD_DATE", SqlDbType.DateTime)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = CDate(DateTimePicker1.Text)
myparameter = myCommand.Parameters.Add("@ADD_REN", SqlDbType.VarChar, 10)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = node10
myparameter = myCommand.Parameters.Add("@ASSET_TYPE", SqlDbType.VarChar, 1)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = 2
myparameter = myCommand.Parameters.Add("@BAK", SqlDbType.VarChar, 200)
myparameter.Direction = ParameterDirection.Input
myparameter.Value = TextBox1.Text
myConnetion.Open()
myCommand.ExecuteNonQuery()
myConnetion.Close()
MsgBox("成功转移!!!")
Catch ex As Exception
MsgBox("Transfer Button1_Click error")
End Try
Else
MsgBox("转出部门和转入部门不能相同。。。。")
End If
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -