Public Shared Sub usrProfileInsert(ByVal comboSerial As ComboBox, ByVal txtCpName As TextBox, ByVal txtUsrName As TextBox, ByVal txtIPAddress As TextBox, ByVal txtSpeed As TextBox, ByVal txtMemory As TextBox, ByVal txtHD1 As TextBox, ByVal txtHD2 As TextBox, ByVal txtHDType As TextBox, ByVal txtOS As TextBox)
Dim strConn As String = "Provider=Microsoft.Jet.OLEDB.4.0;" & "Data Source=" & mdbPath
Dim strSerial, strCompName, strUser, strIPAddress, strHDType, strOS As String
Dim strSpeed, strMemory, strHD1, strHD2 As Long
Dim cn As New OleDbConnection(strConn)
cn.Open()
Dim cmd As OleDbCommand = cn.CreateCommand()
strSerial = comboSerial.Text
strCompName = txtCpName.Text
strUser = txtUsrName.Text
strIPAddress = txtIPAddress.Text
strSpeed = CInt(txtSpeed.Text)
strMemory = CInt(txtMemory.Text)
strHD1 = CDec(txtHD1.Text)
strHD2 = CDec(txtHD2.Text)
strHDType = txtHDType.Text
strOS = txtOS.Text
Try
cmd.CommandText = "INSERT INTO UserProfile (DPSerial, ComputerName, User, IP_Address, Speed, Memory, HD1, HD2, HDType, OS) VALUES ('" & strSerial & "', '" & strCompName & "', '" & strUser & "', '" & strIPAddress & "', " & strSpeed & ", " & strMemory & ", " & strHD1 & ", " & strHD2 & ", '" & strHDType & "', '" & strOS & "')"
Dim intRecordAffected As Integer = cmd.ExecuteNonQuery()
If intRecordAffected = 1 Then
MsgBox("Insert Successful")
End If
cn.Close()
Catch ex As Exception
MessageBox.Show(ex.Message)
End Try
End Sub