Wednesday, 12 June 2013

Prevent From Duplicate Record editing in Ultragrid

I Resolve this Problem By using That Type of Check

  Dim frmdrug As New frmDrugSearch
                If Cbxprovider.Text = Nothing Then
                    MessageBox.Show("Please Select the Provider First.........")
                Else
                    Dim rw As UltraGridRow = Cbxprovider.SelectedRow()

                    If frmdrug.ShowDialog(ListFormOpenMode.SelectionOnly) = Windows.Forms.DialogResult.OK Then
                        If dsView.Tables(0).Select("DRUG_NDC = '" + frmdrug.DRUG_NDC + "' AND PROVIDER_ID = " + selectedProvider + " ").Length = 0 Then
                            Dim newRow As DataRow = dsView.Tables(0).NewRow
                            newRow("DRUG_ID") = frmdrug.MEDICATION_ID
                            newRow("DRUG_NDC") = frmdrug.DRUG_NDC
                            newRow("DRUG_NAME") = frmdrug.BRAND_NAME
                            newRow("ACTIVE") = True
                            newRow("PROVIDER_ID") = selectedProvider
                            dsView.Tables(0).Rows.Add(newRow)
                        Else
                            MessageBox.Show("Selected Grug Already Exists", "Add")
                        End If

                    End If

No comments:

Post a Comment