|
-
Apr 8th, 2005, 02:40 PM
#1
Thread Starter
Junior Member
MySQL VB6 and Regex
Hi,
I will try and explain my problem to the best of my ability. I have some code that access' 2 MySQL tables and retrives some values, one of these being a set of regular expressions, and the other being the stings that i wish to test the regular expression on. The problem occurs when i try and loop around these values, my first loop is to loop around the regular expressions, and the sencond loop is to loop around the strings to match against the regular expression.
Code:
Do Until rdoRsReg.EOF
With rdoRsReg
objRE.Pattern = !Regexpression
objRE.Global = True
Do Until rdoRS.EOF
With rdoRS
Set objMatches = objRE.Execute(!Query_text)
If objMatches.count > 0 Then
For Each objMatch In objMatches
Text2.Text = Text2.Text + vbCrLf & !Query_ID & objMatch.Value '"Sentence end found at position " & objMatch.FirstIndex
Next
Else
Text2.Text = Text2.Text & "The expression was not found"
End If
rdoRS.MoveNext
End With
Loop
rdoRsReg.MoveNext
End With
Loop
When i step through the debugger is say i am using an invalid use of null on the following line :
Code:
Set objMatches = objRE.Execute(!Query_text)
To begin with the !Query_text is holding a correct value from the table, but when i step past it, it the turns to null and errors.
Any help would be great
I hope i have explained my problem clearly, if not please ask for more detail
-
Apr 11th, 2005, 04:31 AM
#2
Frenzied Member
Re: MySQL VB6 and Regex
So are you saying that !QueryText changes to NULL during the iteration (i.e. before the MoveNext) or as you loop through the records?
Could you try a check such as:
VB Code:
If Not IsNull(!Query_text) then
'do the regex check here
End If
Have you tried assigning the value to a local variable?
VB Code:
Dim strTest as string
strTest = !Query_text
Set objMatches = objRE.Execute(strTest)
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|