Dim sqlconn As New SqlClient.SqlConnection
sqlconn.ConnectionString = "server = SKPI-APPS1;" & _
"Database = EOEMS;integrated security=true"
Dim myCommand As New SqlCommand
Dim ra As Integer
sqlconn.Open()
myCommand = New SqlCommand("INSERT INTO tblOfficeEquipmentProfile(OE_Category,OE_SubCategory,OE_ID,OE_Name,OE_User,OE_Brand,OE_Model,OE_Specs,OE_SerialNo,OE_PropertyNo,OE_MacAddress,OE_Static_IP,OE_Vendor,OE_PurchaseDate,OE_WarrantyInclusiveYear,OE_WarrantyStatus,OE_Status,OE_Dept_Code,OE_Location_Code,OE_Remarks) VALUES('" + cmbCategory.Text + "','" + cmbSubCategory.Text + "','" + txtOEID.Text + "','" + txtName.Text + "','" + txtUser.Text + "','" + cmbBrand.Text + "','" + cmbModel.Text + "','" + txtSpecs.Text + "','" + txtSerialNo.Text + "','" + txtPropertyNo.Text + "','" + txtStaticIp.Text + "','" + txtVendor.Text + "','" + txtPurchaseDate.Text + "','" + cmbWarrantyInclusiveYear.Text + "','" + txtStatus.Text + "','" + cmbDeptCode.Text + "','" + cmbLocationCode.Text + "','" + cmbRemarks.Text + "')", sqlconn)
myCommand.ExecuteNonQuery()
MessageBox.Show("New Row Inserted" & ra)
sqlconn.Close()
编辑这是我添加按钮的全部代码