📄 add_player.vb
字号:
Imports System.Data
Imports System.Data.SqlClient
Imports System.IO
Public Class add_player
Inherits System.Windows.Forms.Form
Dim myconnection As SqlConnection = New _
SqlConnection("server=(local);database=footballplayer_change;" & _
"uid=sa;pwd=sa;")
Dim myadapter As SqlDataAdapter = New SqlDataAdapter("select * from buying", myconnection)
Dim myds As DataSet
Dim mydv As DataView
Dim mycurrencymanager As CurrencyManager
#Region " Windows 窗体设计器生成的代码 "
Public Sub New()
MyBase.New()
'该调用是 Windows 窗体设计器所必需的。
InitializeComponent()
'在 InitializeComponent() 调用之后添加任何初始化
End Sub
'窗体重写处置以清理组件列表。
Protected Overloads Overrides Sub Dispose(ByVal disposing As Boolean)
If disposing Then
If Not (components Is Nothing) Then
components.Dispose()
End If
End If
MyBase.Dispose(disposing)
End Sub
'Windows 窗体设计器所必需的
Private components As System.ComponentModel.IContainer
'注意:以下过程是 Windows 窗体设计器所必需的
'可以使用 Windows 窗体设计器修改此过程。
'不要使用代码编辑器修改它。
Friend WithEvents GroupBox1 As System.Windows.Forms.GroupBox
Friend WithEvents txt_value As System.Windows.Forms.TextBox
Friend WithEvents Label6 As System.Windows.Forms.Label
Friend WithEvents txt_name As System.Windows.Forms.TextBox
Friend WithEvents Label5 As System.Windows.Forms.Label
Friend WithEvents txt_ability As System.Windows.Forms.TextBox
Friend WithEvents label4 As System.Windows.Forms.Label
Friend WithEvents Label1 As System.Windows.Forms.Label
Friend WithEvents txt_salary As System.Windows.Forms.TextBox
Friend WithEvents Label8 As System.Windows.Forms.Label
Friend WithEvents txt_height As System.Windows.Forms.TextBox
Friend WithEvents Label9 As System.Windows.Forms.Label
Friend WithEvents txt_weight As System.Windows.Forms.TextBox
Friend WithEvents Label10 As System.Windows.Forms.Label
Friend WithEvents txt_gender As System.Windows.Forms.TextBox
Friend WithEvents Label11 As System.Windows.Forms.Label
Friend WithEvents txt_posi As System.Windows.Forms.TextBox
Friend WithEvents Label12 As System.Windows.Forms.Label
Friend WithEvents txt_birth As System.Windows.Forms.TextBox
Friend WithEvents Label13 As System.Windows.Forms.Label
Friend WithEvents txt_club As System.Windows.Forms.TextBox
Friend WithEvents Button1 As System.Windows.Forms.Button
<System.Diagnostics.DebuggerStepThrough()> Private Sub InitializeComponent()
Me.GroupBox1 = New System.Windows.Forms.GroupBox
Me.Button1 = New System.Windows.Forms.Button
Me.txt_club = New System.Windows.Forms.TextBox
Me.Label13 = New System.Windows.Forms.Label
Me.txt_birth = New System.Windows.Forms.TextBox
Me.Label12 = New System.Windows.Forms.Label
Me.txt_posi = New System.Windows.Forms.TextBox
Me.Label11 = New System.Windows.Forms.Label
Me.txt_gender = New System.Windows.Forms.TextBox
Me.Label10 = New System.Windows.Forms.Label
Me.txt_weight = New System.Windows.Forms.TextBox
Me.Label9 = New System.Windows.Forms.Label
Me.txt_height = New System.Windows.Forms.TextBox
Me.Label8 = New System.Windows.Forms.Label
Me.txt_salary = New System.Windows.Forms.TextBox
Me.Label1 = New System.Windows.Forms.Label
Me.txt_value = New System.Windows.Forms.TextBox
Me.Label6 = New System.Windows.Forms.Label
Me.txt_name = New System.Windows.Forms.TextBox
Me.Label5 = New System.Windows.Forms.Label
Me.txt_ability = New System.Windows.Forms.TextBox
Me.label4 = New System.Windows.Forms.Label
Me.GroupBox1.SuspendLayout()
Me.SuspendLayout()
'
'GroupBox1
'
Me.GroupBox1.Controls.Add(Me.Button1)
Me.GroupBox1.Controls.Add(Me.txt_club)
Me.GroupBox1.Controls.Add(Me.Label13)
Me.GroupBox1.Controls.Add(Me.txt_birth)
Me.GroupBox1.Controls.Add(Me.Label12)
Me.GroupBox1.Controls.Add(Me.txt_posi)
Me.GroupBox1.Controls.Add(Me.Label11)
Me.GroupBox1.Controls.Add(Me.txt_gender)
Me.GroupBox1.Controls.Add(Me.Label10)
Me.GroupBox1.Controls.Add(Me.txt_weight)
Me.GroupBox1.Controls.Add(Me.Label9)
Me.GroupBox1.Controls.Add(Me.txt_height)
Me.GroupBox1.Controls.Add(Me.Label8)
Me.GroupBox1.Controls.Add(Me.txt_salary)
Me.GroupBox1.Controls.Add(Me.Label1)
Me.GroupBox1.Controls.Add(Me.txt_value)
Me.GroupBox1.Controls.Add(Me.Label6)
Me.GroupBox1.Controls.Add(Me.txt_name)
Me.GroupBox1.Controls.Add(Me.Label5)
Me.GroupBox1.Controls.Add(Me.txt_ability)
Me.GroupBox1.Controls.Add(Me.label4)
Me.GroupBox1.Location = New System.Drawing.Point(16, 16)
Me.GroupBox1.Name = "GroupBox1"
Me.GroupBox1.Size = New System.Drawing.Size(480, 352)
Me.GroupBox1.TabIndex = 0
Me.GroupBox1.TabStop = False
Me.GroupBox1.Text = "GroupBox1"
'
'Button1
'
Me.Button1.Location = New System.Drawing.Point(384, 304)
Me.Button1.Name = "Button1"
Me.Button1.Size = New System.Drawing.Size(72, 32)
Me.Button1.TabIndex = 38
Me.Button1.Text = "确定"
'
'txt_club
'
Me.txt_club.Location = New System.Drawing.Point(248, 320)
Me.txt_club.Name = "txt_club"
Me.txt_club.Size = New System.Drawing.Size(72, 21)
Me.txt_club.TabIndex = 37
Me.txt_club.Text = ""
'
'Label13
'
Me.Label13.Location = New System.Drawing.Point(184, 320)
Me.Label13.Name = "Label13"
Me.Label13.Size = New System.Drawing.Size(56, 16)
Me.Label13.TabIndex = 36
Me.Label13.Text = "俱乐部"
'
'txt_birth
'
Me.txt_birth.Location = New System.Drawing.Point(256, 280)
Me.txt_birth.Name = "txt_birth"
Me.txt_birth.Size = New System.Drawing.Size(64, 21)
Me.txt_birth.TabIndex = 35
Me.txt_birth.Text = ""
'
'Label12
'
Me.Label12.Location = New System.Drawing.Point(184, 280)
Me.Label12.Name = "Label12"
Me.Label12.Size = New System.Drawing.Size(56, 16)
Me.Label12.TabIndex = 34
Me.Label12.Text = "生日"
'
'txt_posi
'
Me.txt_posi.Location = New System.Drawing.Point(256, 248)
Me.txt_posi.Name = "txt_posi"
Me.txt_posi.Size = New System.Drawing.Size(64, 21)
Me.txt_posi.TabIndex = 33
Me.txt_posi.Text = ""
'
'Label11
'
Me.Label11.Location = New System.Drawing.Point(184, 248)
Me.Label11.Name = "Label11"
Me.Label11.Size = New System.Drawing.Size(48, 16)
Me.Label11.TabIndex = 32
Me.Label11.Text = "位置"
'
'txt_gender
'
Me.txt_gender.Location = New System.Drawing.Point(272, 216)
Me.txt_gender.Name = "txt_gender"
Me.txt_gender.Size = New System.Drawing.Size(48, 21)
Me.txt_gender.TabIndex = 31
Me.txt_gender.Text = ""
'
'Label10
'
Me.Label10.Location = New System.Drawing.Point(184, 216)
Me.Label10.Name = "Label10"
Me.Label10.Size = New System.Drawing.Size(40, 16)
Me.Label10.TabIndex = 30
Me.Label10.Text = "性别"
'
'txt_weight
'
Me.txt_weight.Location = New System.Drawing.Point(256, 176)
Me.txt_weight.Name = "txt_weight"
Me.txt_weight.Size = New System.Drawing.Size(64, 21)
Me.txt_weight.TabIndex = 29
Me.txt_weight.Text = ""
'
'Label9
'
Me.Label9.Location = New System.Drawing.Point(184, 176)
Me.Label9.Name = "Label9"
Me.Label9.Size = New System.Drawing.Size(48, 16)
Me.Label9.TabIndex = 28
Me.Label9.Text = "体重"
'
'txt_height
'
Me.txt_height.Location = New System.Drawing.Point(256, 144)
Me.txt_height.Name = "txt_height"
Me.txt_height.Size = New System.Drawing.Size(64, 21)
Me.txt_height.TabIndex = 27
Me.txt_height.Text = ""
'
'Label8
'
Me.Label8.Location = New System.Drawing.Point(184, 144)
Me.Label8.Name = "Label8"
Me.Label8.Size = New System.Drawing.Size(56, 16)
Me.Label8.TabIndex = 26
Me.Label8.Text = "身高"
'
'txt_salary
'
Me.txt_salary.Location = New System.Drawing.Point(240, 48)
Me.txt_salary.Name = "txt_salary"
Me.txt_salary.Size = New System.Drawing.Size(80, 21)
Me.txt_salary.TabIndex = 25
Me.txt_salary.Text = ""
'
'Label1
'
Me.Label1.Location = New System.Drawing.Point(184, 48)
Me.Label1.Name = "Label1"
Me.Label1.Size = New System.Drawing.Size(40, 16)
Me.Label1.TabIndex = 24
Me.Label1.Text = "薪金"
'
'txt_value
'
Me.txt_value.Location = New System.Drawing.Point(240, 112)
Me.txt_value.Name = "txt_value"
Me.txt_value.Size = New System.Drawing.Size(80, 21)
Me.txt_value.TabIndex = 21
Me.txt_value.Text = ""
'
'Label6
'
Me.Label6.Location = New System.Drawing.Point(184, 112)
Me.Label6.Name = "Label6"
Me.Label6.Size = New System.Drawing.Size(56, 16)
Me.Label6.TabIndex = 20
Me.Label6.Text = "身价"
'
'txt_name
'
Me.txt_name.Location = New System.Drawing.Point(240, 16)
Me.txt_name.Name = "txt_name"
Me.txt_name.Size = New System.Drawing.Size(80, 21)
Me.txt_name.TabIndex = 19
Me.txt_name.Text = ""
'
'Label5
'
Me.Label5.Location = New System.Drawing.Point(184, 16)
Me.Label5.Name = "Label5"
Me.Label5.Size = New System.Drawing.Size(40, 16)
Me.Label5.TabIndex = 18
Me.Label5.Text = "姓名"
'
'txt_ability
'
Me.txt_ability.Location = New System.Drawing.Point(256, 80)
Me.txt_ability.Name = "txt_ability"
Me.txt_ability.Size = New System.Drawing.Size(64, 21)
Me.txt_ability.TabIndex = 15
Me.txt_ability.Text = ""
'
'label4
'
Me.label4.Location = New System.Drawing.Point(184, 80)
Me.label4.Name = "label4"
Me.label4.Size = New System.Drawing.Size(56, 16)
Me.label4.TabIndex = 14
Me.label4.Text = "能力"
'
'add_player
'
Me.AutoScaleBaseSize = New System.Drawing.Size(6, 14)
Me.ClientSize = New System.Drawing.Size(508, 386)
Me.Controls.Add(Me.GroupBox1)
Me.Name = "add_player"
Me.Text = "add_player"
Me.GroupBox1.ResumeLayout(False)
Me.ResumeLayout(False)
End Sub
#End Region
Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
Dim tempset As DataSet = New DataSet()
Dim tempadapter As SqlDataAdapter = New SqlDataAdapter()
Dim myCommand As SqlCommand = New SqlCommand()
myCommand.CommandType = CommandType.StoredProcedure
myCommand.Connection = myconnection
myCommand.CommandText = "p_newplayer"
myCommand.Parameters.Add("@new_name", txt_name.Text)
myCommand.Parameters.Add("@new_salary", CDbl(txt_salary.Text))
myCommand.Parameters.Add("@new_ability", txt_ability.Text)
myCommand.Parameters.Add("@new_value", CDbl(txt_value.Text))
myCommand.Parameters.Add("@new_height", txt_height.Text)
myCommand.Parameters.Add("@new_weight", txt_weight.Text)
myCommand.Parameters.Add("@new_gender", txt_gender.Text)
myCommand.Parameters.Add("@new_position", txt_posi.Text)
myCommand.Parameters.Add("@new_birthday", txt_birth.Text)
myCommand.Parameters.Add("@new_cid", txt_club.Text)
tempadapter.SelectCommand = myCommand
myconnection.Open()
Try
tempadapter.SelectCommand.ExecuteNonQuery()
Catch ex As Exception
MsgBox(ex.ToString)
End Try
'myadapter.SelectCommand.ExecuteNonQuery()
myconnection.Close()
End Sub
Private Sub GroupBox1_Enter(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles GroupBox1.Enter
End Sub
End Class
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -