问:请问该数据库中的type列,怎么用查询,以逗号将该数据分割开
答:通过下面的自定义函数,结合查询来达到这一目的:
Function A(strType As String)
Dim x As Integer
x = InStr(strType, ",") - 2
A = Mid(strType, 2, x)
End Function
Function B(strType As String, strType2 As String)
Dim x As Integer
Dim typeTemp As String
typeTemp = Mid(Replace(strType, strType2, ""), 3)
x = InStr(typeTemp, ",") - 2
If x > 0 Then
B = Mid(typeTemp, 2, x)
Else
B = Mid(typeTemp, 2)
End If
End Function
Function C(strType As String, strType2 As String, strType3 As String)
Dim x As Integer
Dim y As Integer
Dim typeTemp As String
x = Len(strType2 & strType3) + 6
typeTemp = Mid(strType, x)
y = InStr(typeTemp, ",") - 1
If y > 0 Then
C = Mid(typeTemp, 1, y)
Else
C = Replace(typeTemp, """", "")
End If
End Function
Function strD(strType As String, strType2 As String, strType3 As String, strType4 As String)
Dim x As Integer
Dim typeTemp As String
x = Len(strType2 & strType3 & strType4) + 6
typeTemp = Mid(strType, x)
strD = Mid(typeTemp, 2)
End Function
示 例:见下面的链接
更多参考:
论坛中本主题相关讨论帖子链接: cgi-bin/dispbbs.asp?boardID=90&ID=1905