📄 customersform.vb
字号:
Me.DataSet11.DataSetName = "DataSet1"
Me.DataSet11.Locale = New System.Globalization.CultureInfo("en-US")
Me.DataSet11.Namespace = "http://www.tempuri.org/DataSet1.xsd"
'
'DataGridTableStyle1
'
Me.DataGridTableStyle1.DataGrid = Me.DataGrid1
Me.DataGridTableStyle1.GridColumnStyles.AddRange(New System.Windows.Forms.DataGridColumnStyle() {Me.DataGridTextBoxColumn1, Me.DataGridTextBoxColumn2, Me.DataGridTextBoxColumn3, Me.DataGridTextBoxColumn4, Me.DataGridTextBoxColumn5, Me.DataGridTextBoxColumn6})
Me.DataGridTableStyle1.HeaderFont = New System.Drawing.Font("Verdana", 11.25!, System.Drawing.FontStyle.Bold, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.DataGridTableStyle1.HeaderForeColor = System.Drawing.SystemColors.ControlText
Me.DataGridTableStyle1.MappingName = "Customers"
Me.DataGridTableStyle1.PreferredColumnWidth = 50
'
'DataGridTextBoxColumn1
'
Me.DataGridTextBoxColumn1.Alignment = System.Windows.Forms.HorizontalAlignment.Center
Me.DataGridTextBoxColumn1.Format = ""
Me.DataGridTextBoxColumn1.FormatInfo = Nothing
Me.DataGridTextBoxColumn1.HeaderText = "ID"
Me.DataGridTextBoxColumn1.MappingName = "CustomerID"
Me.DataGridTextBoxColumn1.Width = 60
'
'DataGridTextBoxColumn2
'
Me.DataGridTextBoxColumn2.Format = ""
Me.DataGridTextBoxColumn2.FormatInfo = Nothing
Me.DataGridTextBoxColumn2.HeaderText = "Company"
Me.DataGridTextBoxColumn2.MappingName = "CompanyName"
Me.DataGridTextBoxColumn2.Width = 150
'
'DataGridTextBoxColumn3
'
Me.DataGridTextBoxColumn3.Format = ""
Me.DataGridTextBoxColumn3.FormatInfo = Nothing
Me.DataGridTextBoxColumn3.HeaderText = "Contact"
Me.DataGridTextBoxColumn3.MappingName = "ContactName"
Me.DataGridTextBoxColumn3.Width = 80
'
'DataGridTextBoxColumn4
'
Me.DataGridTextBoxColumn4.Format = ""
Me.DataGridTextBoxColumn4.FormatInfo = Nothing
Me.DataGridTextBoxColumn4.HeaderText = "Title"
Me.DataGridTextBoxColumn4.MappingName = "ContactTitle"
Me.DataGridTextBoxColumn4.Width = 80
'
'DataGridTextBoxColumn5
'
Me.DataGridTextBoxColumn5.Format = ""
Me.DataGridTextBoxColumn5.FormatInfo = Nothing
Me.DataGridTextBoxColumn5.HeaderText = "Address"
Me.DataGridTextBoxColumn5.MappingName = "Address"
Me.DataGridTextBoxColumn5.Width = 75
'
'DataGridTextBoxColumn6
'
Me.DataGridTextBoxColumn6.Format = ""
Me.DataGridTextBoxColumn6.FormatInfo = Nothing
Me.DataGridTextBoxColumn6.HeaderText = "City"
Me.DataGridTextBoxColumn6.MappingName = "City"
Me.DataGridTextBoxColumn6.Width = 60
'
'SqlConnection1
'
Me.SqlConnection1.ConnectionString = "data source=(local);initial catalog=Northwind;persist security info=False;user id" & _
"=sa;workstation id=PROTSERVER;packet size=4096"
'
'Button2
'
Me.Button2.Anchor = (System.Windows.Forms.AnchorStyles.Bottom Or System.Windows.Forms.AnchorStyles.Right)
Me.Button2.Font = New System.Drawing.Font("Verdana", 11.25!, System.Drawing.FontStyle.Regular, System.Drawing.GraphicsUnit.Point, CType(0, Byte))
Me.Button2.Location = New System.Drawing.Point(344, 272)
Me.Button2.Name = "Button2"
Me.Button2.Size = New System.Drawing.Size(160, 40)
Me.Button2.TabIndex = 1
Me.Button2.Text = "Update Table"
'
'SqlDataAdapter1
'
Me.SqlDataAdapter1.ContinueUpdateOnError = True
Me.SqlDataAdapter1.DeleteCommand = Me.SqlDeleteCommand1
Me.SqlDataAdapter1.InsertCommand = Me.SqlInsertCommand1
Me.SqlDataAdapter1.SelectCommand = Me.SqlSelectCommand1
Me.SqlDataAdapter1.TableMappings.AddRange(New System.Data.Common.DataTableMapping() {New System.Data.Common.DataTableMapping("Table", "Customers", New System.Data.Common.DataColumnMapping() {New System.Data.Common.DataColumnMapping("CustomerID", "CustomerID"), New System.Data.Common.DataColumnMapping("CompanyName", "CompanyName"), New System.Data.Common.DataColumnMapping("ContactName", "ContactName"), New System.Data.Common.DataColumnMapping("ContactTitle", "ContactTitle"), New System.Data.Common.DataColumnMapping("Address", "Address"), New System.Data.Common.DataColumnMapping("City", "City"), New System.Data.Common.DataColumnMapping("Region", "Region"), New System.Data.Common.DataColumnMapping("PostalCode", "PostalCode"), New System.Data.Common.DataColumnMapping("Country", "Country"), New System.Data.Common.DataColumnMapping("Phone", "Phone"), New System.Data.Common.DataColumnMapping("Fax", "Fax")})})
Me.SqlDataAdapter1.UpdateCommand = Me.SqlUpdateCommand1
'
'SqlDeleteCommand1
'
Me.SqlDeleteCommand1.CommandText = "DELETE FROM dbo.Customers WHERE (CustomerID = @CustomerID) AND (Address = @Addres" & _
"s OR @Address1 IS NULL AND Address IS NULL) AND (City = @City OR @City1 IS NULL " & _
"AND City IS NULL) AND (CompanyName = @CompanyName) AND (ContactName = @ContactNa" & _
"me OR @ContactName1 IS NULL AND ContactName IS NULL) AND (ContactTitle = @Contac" & _
"tTitle OR @ContactTitle1 IS NULL AND ContactTitle IS NULL) AND (Country = @Count" & _
"ry OR @Country1 IS NULL AND Country IS NULL) AND (Fax = @Fax OR @Fax1 IS NULL AN" & _
"D Fax IS NULL) AND (Phone = @Phone OR @Phone1 IS NULL AND Phone IS NULL) AND (Po" & _
"stalCode = @PostalCode OR @PostalCode1 IS NULL AND PostalCode IS NULL) AND (Regi" & _
"on = @Region OR @Region1 IS NULL AND Region IS NULL)"
Me.SqlDeleteCommand1.Connection = Me.SqlConnection1
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CustomerID", System.Data.SqlDbType.NChar, 5, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CustomerID", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address", System.Data.SqlDbType.NVarChar, 60, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Address", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Address1", System.Data.SqlDbType.NVarChar, 60, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Address", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@City", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "City", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@City1", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "City", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@CompanyName", System.Data.SqlDbType.NVarChar, 40, System.Data.ParameterDirection.Input, False, CType(0, Byte), CType(0, Byte), "CompanyName", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ContactName", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "ContactName", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ContactName1", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "ContactName", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ContactTitle", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "ContactTitle", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@ContactTitle1", System.Data.SqlDbType.NVarChar, 30, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "ContactTitle", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Country", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Country", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Country1", System.Data.SqlDbType.NVarChar, 15, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Country", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Fax", System.Data.SqlDbType.NVarChar, 24, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Fax", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Fax1", System.Data.SqlDbType.NVarChar, 24, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Fax", System.Data.DataRowVersion.Original, Nothing))
Me.SqlDeleteCommand1.Parameters.Add(New System.Data.SqlClient.SqlParameter("@Phone", System.Data.SqlDbType.NVarChar, 24, System.Data.ParameterDirection.Input, True, CType(0, Byte), CType(0, Byte), "Phone", System.Data.DataRowVersion.Original, Nothing))
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -