Professional Documents
Culture Documents
Myka
Myka
MySqlClient
adpt.Fill(ds, "DGV1")
DGV1.DataSource = ds.Tables(0)
con.Close()
TextBoxRFIDTag.Clear()
TextBoxFName.Clear()
TextBoxMName.Clear()
TextBoxLName.Clear()
TextBoxAddress.Clear()
TextBoxContactNo.Clear()
TextBoxIDNum.Clear()
ComboBoxYear.Text = "Select Year"
ComboBoxCourse.Text = "Select Course"
LabelDept.Text = ""
End Sub
End Sub
Try
cmd = con.CreateCommand
cmd.CommandText = "insert into userinformation
(Gender,Address,ContactNo,IDNumber,Year,Course,Department)values(@Gender,@Address,@
ContactNo,@IDNumber,@Year,@Course,@Department);"
cmd.Parameters.AddWithValue("@Gender", RadioButtonFemale.Checked)
cmd.Parameters.AddWithValue("@Gender", RadioButtonMale.Checked)
cmd.Parameters.AddWithValue("@Address", TextBoxAddress.Text)
cmd.Parameters.AddWithValue("@ContactNo", TextBoxContactNo.Text)
cmd.Parameters.AddWithValue("@IDNumber", TextBoxIDNum.Text)
cmd.Parameters.AddWithValue("@Year", ComboBoxYear.Text)
cmd.Parameters.AddWithValue("@Course", ComboBoxCourse.Text)
cmd.Parameters.AddWithValue("@Department", LabelDept.Text)
cmd.ExecuteNonQuery()
loaddatagrid()
Catch ex As Exception
con.Close()
End Try
End Sub
con.Open()
Try
cmd = con.CreateCommand()
cmd.CommandText = "update userinformation set
FirstName=@FirstName,MiddleName=@MiddleName,LastName=@LastName, Gender=@Gender,
Address=@Address, ContactNo=@ContactNo, IDNumber=@IDNumber, Year=@Year,
Course=@Course, Department=@Department where RFIDTag=@RFIDTag;"
cmd.Parameters.AddWithValue("@RFIDTag", TextBoxRFIDTag.Text)
cmd.Parameters.AddWithValue("@FirstName", TextBoxFName.Text)
cmd.Parameters.AddWithValue("@MiddleName", TextBoxMName.Text)
cmd.Parameters.AddWithValue("@LastName", TextBoxLName.Text)
cmd.Parameters.AddWithValue("@Gender", RadioButtonFemale.Checked And
RadioButtonMale.Checked)
cmd.Parameters.AddWithValue("@Address", TextBoxAddress.Text)
cmd.Parameters.AddWithValue("@ContactNo", TextBoxContactNo.Text)
cmd.Parameters.AddWithValue("@IDNumber", TextBoxIDNum.Text)
cmd.Parameters.AddWithValue("@Year", ComboBoxYear.Text)
cmd.Parameters.AddWithValue("@Course", ComboBoxCourse.Text)
cmd.Parameters.AddWithValue("@Department", LabelDept.Text)
cmd.ExecuteNonQuery()
loaddatagrid()
Catch ex As Exception
End Try
End Sub
con.Open()
Try
cmd = con.CreateCommand()
cmd.CommandText = "delete from userinformation where
RFIDTag=@RFIDTag"
cmd.Parameters.AddWithValue("@RFIDTag", TextBoxRFIDTag.Text)
cmd.Parameters.AddWithValue("@FirstName", TextBoxFName.Text)
cmd.Parameters.AddWithValue("@MiddleName", TextBoxMName.Text)
cmd.Parameters.AddWithValue("@LastName", TextBoxLName.Text)
cmd.Parameters.AddWithValue("@Gender", gender)
cmd.Parameters.AddWithValue("@Address", TextBoxAddress.Text)
cmd.Parameters.AddWithValue("@ContactNo", TextBoxContactNo.Text)
cmd.Parameters.AddWithValue("@IDNumber", TextBoxIDNum.Text)
cmd.Parameters.AddWithValue("@Year", ComboBoxYear.Text)
cmd.Parameters.AddWithValue("@Course", ComboBoxCourse.Text)
cmd.Parameters.AddWithValue("@Department", LabelDept.Text)
cmd.ExecuteNonQuery()
loaddatagrid()
Catch ex As Exception
End Try
Else
End If
End Sub
End Try
End Sub
End Sub
Try
TextBoxRFIDTag.Text = row.Cells(0).Value.ToString()
TextBoxFName.Text = row.Cells(1).Value.ToString()
TextBoxMName.Text = row.Cells(2).Value.ToString()
TextBoxLName.Text = row.Cells(3).Value.ToString()
gender = row.Cells(4).Value.ToString()
TextBoxAddress.Text = row.Cells(5).Value.ToString()
TextBoxContactNo.Text = row.Cells(6).Value.ToString()
TextBoxIDNum.Text = row.Cells(7).Value.ToString()
ComboBoxYear.Text = row.Cells(8).Value.ToString()
ComboBoxCourse.Text = row.Cells(9).Value.ToString()
LabelDept.Text = row.Cells(10).Value.ToString()
Catch ex As Exception
End Try
End Sub
End If
End Sub
If (e.KeyChar < Chr(48) Or e.KeyChar > Chr(57)) And e.KeyChar <> Chr(8)
Then
e.Handled = True
End If
End Sub
e.Handled = True
End If
End Sub
Try
con.Open()
adapter = New MySqlDataAdapter(" select * from userinformation where
LastName like '%" & TextBoxSearch.Text & "%'", con)
adapter.Fill(ds)
DGV1.DataSource = ds.Tables(0)
con.Close()
TextBoxRFIDTag.Clear()
TextBoxFName.Clear()
TextBoxMName.Clear()
TextBoxLName.Clear()
TextBoxContactNo.Clear()
gender = ""
TextBoxIDNum.Clear()
ComboBoxYear.Text = "Select Year"
ComboBoxCourse.Text = "Select Course"
LabelDept.Text = "Select Year and Course"
Catch ex As Exception
End Try
End Sub
Else
MsgBox("Select Year and Course")
End If
End Sub
End Sub
End Class