webForumDet fria alternativet

Fel antal argument eller felaktig egenskapstilldelning.

ASP

2 svar · 463 visningar · startad av Dee

Medlem sedan okt. 2001110 inlägg
Frågan#1
<%@ Language=VBScript%>
<%

Option Explicit
Dim objRegExp, intMatches
Dim intLimit, strError 

Function collectData(intLimit)
strError = intLimit & "&nbsp;&auml;r inget godk&auml;nt datum. V&auml;nligen formatera datumet enligt: &Aring;&Aring;&Aring;&Aring;MM"

	If len(intLimit) <> 6 Then
		Response.Write strError
	ElseIf len(intLimit) = 6 Then
		'check string, only 0-9 allowed
		Set objRegExp = New regexp
		objRegExp.Global = true
		objRegExp.IgnoreCase = true
		objRegExp.Pattern = "[^0-9]"
		Set intMatches = objRegExp.Execute(intLimit)
			[B]If intMatches <> 0 Then  '<-- line 20
				Response.Write strError
			Else
				Response.Write "Jippi"
			End If[/B]
	End If

End Function

'# html-output
Response.Write "<html><head><title>Untitled</title></head><body>"
	'run function to collect data
	collectData(200303)
Response.Write "</body></html>"
%>

Kommenterar jag bort If-satsen som börjar på rad 20 så fungerar det, men om jag inte gör det så får jag felmess:

Feltyp:
Körningsfel i Microsoft VBScript (0x800A01C2)
Fel antal argument eller felaktig egenskapstilldelning.
/aspp/Default.asp, line 20

Vad gör jag för fel :q

Medlem sedan dec. 200012 464 inlägg
#2

IntMatches är ett object

If intMatches.count <> 0 Then
Medlem sedan okt. 2001110 inlägg
#3

Tack LarsG.

265 ms totalt · 4 externa anrop · v20260731065814-full.1dc6f849
126 ms — deklarationer (db)
0 ms — hämta statistik (cache)
129 ms — hämta tråd, inlägg och bilagor (db)
133 ms — ändringar (db)