数据库如:型号 备注
         225    1
         225    2
         300    1
         225    2
问题描述:数据库如上所示,对于同一型号的在修改保存数据时如何判断备注也不一样啊?同一个型号的备注是唯一的。
我的程序
     Adodc1.RecordSource = "select * from fhz_user where 备注 like'" & Trim(Text1)& "'"               
 Adodc1.Refresh
                If Adodc1.Recordset.RecordCount > 0 Then
                   MsgBox "输入的备注已经存在,请重新输入!", , "系统提示" 
                    Exit Sub
                    End If
                      
                            Adodc1.Recordset("型号") = Trim(Text2.Text)
                            Adodc1.Recordset("备注") = Trim(Text1.Text)
                            
                            
                           MsgBox "修改信息成功", , "系统提示"
                
                             Adodc1.Recordset.Update
                        Adodc1.RecordSource = "select * from fhz_user "
                            Adodc1.Refresh
                        以上程序只能判断备注是否唯一。

解决方案 »

  1.   

    select count(*) From fhz_user 备注 like'" & Trim(Text1)& "'" where Group by 型号,备注
      

  2.   

    select count(*) From fhz_user where 备注 like'" & Trim(Text1)& "'"  Group by 型号,备注
      

  3.   

    将型号带上不就可以了
    Adodc1.RecordSource = "select * from fhz_user where 型号='" & 变量或文本值 & "' and 备注 like'" & Trim(Text1)& "'" 
      

  4.   

    Adodc1.RecordSource = "select * from fhz_user where 型号 like'" & Trim(Text2)& "'" and  备注 like'" & Trim(Text1)& "'"