我才学习了15天,不会,我的任务比较简单,能帮我写个例子吗?用find

解决方案 »

  1.   

    dim FindName as String
    FindName=txtFind.text
    dim rsFind as adodb.recordset
    ADO数据的连接
    ……
         if rsfind.eof then
            msgbox "对不起数据库中无此物资"
            exit sub
         else 
            加载数据
         end if
      

  2.   

    If Adodc1.Recordset.RecordCount > 0 And IsNull(text1.Text) = False Then
          Adodc1.Recordset.MoveFirst
          Adodc1.Recordset.Find “GSM手机号码='" & text1.Text & "'"
          
       End If
      

  3.   

    对不起,我的基础太差了,不明白,妳能告诉我可以用adodc1.recordset.find() 怎么查找呀
      

  4.   

    IsNull(text1.Text) = False ,这个什么意思呀,能告诉我吗?
      

  5.   

    这是我写的程序,我运行的时候不正确,妳帮我看一下
    Private Sub search_data()     If datPrimaryRS.Recordset.RecordCount > 0 And IsNull(txtFields(10).Text) = False Then
      datPrimaryRS.Recordset.MoveFirst
      datPrimaryRS.Recordset.Find (GSM手机号码 = "ingsmnumber")
      End If
      
      If datPrimaryRS.Recordset.EOF = True Then
        MsgBox "新客户信息,注意"
        datPrimaryRS.Recordset.AddNew
        datPrimaryRS.Recordset.Fields("GSM手机号码") = ingsmnumber
        datPrimaryRS.Recordset.Fields("短消息内容") = inword & "--" & Time & "--" & Date & vbCrLf
        datPrimaryRS.Recordset.Update
    Else
        MsgBox "老客户信息"
        
        datPrimaryRS.Recordset.Fields("短消息内容") = inword & "--" & Time & "--" & Date & vbCrLf
        datPrimaryRS.Recordset.Update
        
    End IfEnd Sub因为我不知道该如何使用find来查询,ingsmnumber是手机号码.inword是短消息内容,我运行程序是,告诉我 datPrimaryRS.Recordset.Find (GSM手机号码 = "ingsmnumber")里的ingsmnuber使用的不正确
    我怎么能保证,如果这个手机号码存在,我能将短消息内容存在这个手机号码的同一个纪录里
      

  6.   

    为什么不用SQL语句呀?
    想用么
    把表结构告诉
    我帮你写SQL语句
      

  7.   

    对不起,我没有学过,妳写我也不明白的,妳看我的程序,find应该怎么用呀
    谢谢
      

  8.   

    jian_aa(aa)说得够明白的了
    .Find "GSM手机号码='" & "ingsmnumber" & "'" !!! "ingsmnumber"就是呢要查找的字符串,可以用变量代替。
    .Find (GSM手机号码 = "ingsmnumber") 你这么写怎么能对呢?好好看看find方法的语法吧
      

  9.   

    没有呀,我会用find了,可是我怎么确定我能把短消息内容存在已经存在的手机号码的同一个记录呢
    能帮我解决吗?
    谢谢
      

  10.   

    Dim sHM As String'存放手机号变量
    Adodc1.Refresh
    With Adodc1.Recordset
        .MoveFirst
        .Find "GSM手机号='" & sHM & "'"
        If Not .EOF Then
            MsgBox "找到!"
        Else
            MsgBox "没有此记录!"
        End If
    End With
      

  11.   

    首先要确定你的数据库表中有这个字段,然后用更新语句就行了
    比如:
    update 表名 set 字段名=字段值 where ....
      

  12.   

    我试了,我接收的是同一个手机的同一条信息,可是没次它不能把短消息存在同一个字段里
    这是我的程序If datPrimaryRS.Recordset.RecordCount > 0 And IsNull(txtFields(10).Text) = False Then
        datPrimaryRS.Refresh
        If Not datPrimaryRS.Recordset.EOF Then datPrimaryRS.Recordset.MoveFirst
        datPrimaryRS.Recordset.Find "GSM手机号码= '" & ingsmnumber & "'"  
    If datPrimaryRS.Recordset.EOF = True Then
          MsgBox "新客户信息,注意"
          datPrimaryRS.Recordset.AddNew
          datPrimaryRS.Recordset.Fields("GSM手机号码") = ingsmnumber
          datPrimaryRS.Recordset.Fields("短消息内容") = inword & "--" & Time & "--" & Date & vbCrLfElse
        MsgBox "老客户信息,请查阅"
        
        datPrimaryRS.Recordset.Fields("短消息内容") = inword & "--" & Time & "--" & Date & vbCrLf
        datPrimaryRS.Recordset.Update
        
    End IfEnd If
      

  13.   

    首先你要确信你的FIND确实能够找到有重复的那一条记录
    其次,如果确实能够找到,而又无法修改它,那么
         就用这样一个办法来实现它,先把它彻底删除掉,
         然后再新添上,
        我想这样在UPDATE后,应该就可以实现你的目的了
     我现在是怀疑你的FIND函数是否能够正确找到你所要的记录
     你自己调试一下看是否正确
      还有你是通过什么来控件显示数据库里的短消息内容的呢? 
      
     
      

  14.   

    我调试了,我每次接收新的信息后,它能自动的存在相应的字段里,问题是新的信息将原来的存在的信息给覆盖了,我想都保留的,怎么能实现呢,我用的控件是text,怎样才能将所有的信息都保留呢,请帮忙呀
    谢谢!!
      

  15.   

    请大家帮忙呀,怎样设置text的属性,将信息全部保留呀
      

  16.   

    If datPrimaryRS.Recordset.EOF = True Then
          MsgBox "新客户信息,注意"
          datPrimaryRS.Recordset.AddNew
          datPrimaryRS.Recordset.Fields("GSM手机号码") = ingsmnumber
          datPrimaryRS.Recordset.Fields("短消息内容") = inword & "--" & Time & "--" & Date & vbCrLfElse
        MsgBox "老客户信息,请查阅"
        
        datPrimaryRS.Recordset.Fields("短消息内容") = datPrimaryRS.Recordset.Fields("短消息内容") & inword & "--" & Time & "--" & Date & vbCrLf
        datPrimaryRS.Recordset.Update
        
    End If思路是找到老客户后将他原来的短消息与新短消息做字符串连接,然后更新记录。
    这样就行了!