Vb.net 使用vb 2010避免ms access上的数据冗余

Vb.net 使用vb 2010避免ms access上的数据冗余,vb.net,Vb.net,我需要一些帮助,关于如何确定我将在我的数据库中输入的信息是否存在或在我的数据库中有相同的记录..请我需要一些帮助。。。多谢各位 这是我保存按钮的代码 Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click rs = New ADODB.Recordset With rs 'check if important item is n

我需要一些帮助,关于如何确定我将在我的数据库中输入的信息是否存在或在我的数据库中有相同的记录..请我需要一些帮助。。。多谢各位

这是我保存按钮的代码

Private Sub btnsave_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles btnsave.Click

rs = New ADODB.Recordset
With rs
    'check if important item is null '
    If txtappln.Text = "" Or txtappfn.Text = "" Or txtappmn.Text = "" Or txtclass.Text = "" Or txtcnum.Text = "" Or txtaddr.Text = "" Or txtbrgy.Text = "" Then
        MsgBox("Some object in the Applicant Personal Information or Classification or Ctrl Number is not filled up", MessageBoxIcon.Warning)
        .Cancel()
    Else
        'Save'
        .Open("Select * from Applicant", con, 2, 3)
        .AddNew()
        .Fields("LAST_NAME").Value = txtappln.Text
        .Fields("FIRST_NAME").Value = txtappfn.Text
        .Fields("MIDDLE_NAME").Value = txtappmn.Text
        .Fields("ADDRESS").Value = txtaddr.Text
        .Fields("CLASSIFICATION").Value = txtclass.Text
        .Fields("CONTROL_NO").Value = txtcnum.Text
        .Fields("BARANGAY").Value = txtbrgy.Text
        MsgBox("Record has been save !!", vbInformation)
        .Update()
        .Close()
    End If
End With`

a) 您容易受到SQL注入攻击;b) 任何唯一标识这个人/事物的东西(比如可能控制?)都是该表PK的候选对象;只要检查它是否已经存在;否则你就有点束手无策了,因为像这样的文本字段会被复制(Bob vs Bobby,Mike vs Michael等)。谢谢你的建议……但是有没有任何选项(比如设置条件)来避免记录复制。。我想确认的另一件事是,目前开发的系统是独立的DBMS。几乎任何非平凡的东西都会有一个ID(比如员工ID)来短路重复测试。如果存在,则该人已经存在。否则,在添加之前,测试姓氏和地址以及其中的1-2个数字是否已经存在。您能生成一个示例代码吗?