|
- SQL = "SELECT 条文号 , 内容 , 内容2 , 内容3 , 出处 FROM (select * from [要略] WHERE 1 =1 order by 出处 asc UNION ALL select 条文号 ,内容, 煎服方法 , Null , 出处 from [伤寒论] WHERE 1 =1 order by 出处 asc ) GROUP BY 条文号 , 内容 , 内容2 , 内容3 , 出处 order by 条文号*1 asc"
- On Error Resume Next
- For II = 1 To Len(.TextBox48.Text) '换格式
- If Mid(.TextBox48.Text, II, 1) = "," Or Mid(.TextBox48.Text, II, 1) = "," Or Mid(.TextBox48.Text, II, 1) = "/" Or Mid(.TextBox48.Text, II, 1) = "、" Then s = s & "," & II
- Next
- If .TextBox48.Text = "" Then Exit Sub
- S1 = Split(s, ",")
- P1 = Mid(.TextBox48.Text, 1, S1(1) - 1) '第一个数
- For M = 0 To UBound(S1)
- P2 = P2 & "," & Mid(.TextBox48.Text, S1(M + 1) + 1, S1(M + 2) - S1(M + 1) - 1)
- Next
- P3 = "," & P1 & P2
- arr = Split(P3, ",")
- For k = 1 To UBound(arr)
- If .TextBox48.Text <> "" Then SQL = SQL & " WHERE (内容 like '%" & arr(k) & "%' or 内容2 like '%" & arr(k) & "%' or 内容3 like '%" & arr(k) & "%')"
- Next
第1句运行正确,2-16不运行,可以查到数据;但是循环到15句就错了,查不到,但是实际有数据。
|
|