关于文本中每行都"汉字与数字相混(前面是汉字,后面是数字)",且每行记录字符数不等,字节数相等,如何实现查询?
如:中国   123456
   中国人 123456

解决方案 »

  1.   

    dim aa as string
    aa="123456"
    select * from 表 where 字段='" & aa & "%'
      

  2.   

    因为VB读文本都是用字符读,取123456,
    第一行用x=mid("中国    123456",7,6),
    第二行用x=mid("中国人  123456",6,6),
    第三行用x=mid("中国人民123456",5,6),
    可不可以用相同的一句
      

  3.   

    Private Sub Command1_Click()
        Dim s As String
        
        s = "中国    123456"
        MsgBox GetValue(s)
    End SubPublic Function GetValue(aStrParam As String) As String
        Dim i As Long, strTmp As String
        
        For i = 1 To Len(aStrParam)
            If Asc(Mid(aStrParam, i, 1)) > 0 Then
                GetValue = Trim(Mid(aStrParam, i))
                Exit Function
            End If
        Next
    End Function
      

  4.   

    Private Sub Command1_Click()
        Dim s As String
        
        s = "中国    123456"
        MsgBox GetValue(s)
    End SubPublic Function GetValue(aStrParam As String) As String
        GetValue = StrReverse(Val(StrReverse(aStrParam)))
    End Function
      

  5.   

    x=midb("中国    123456",9,6)