Ok I changed it to this
<%
'Generates a GUID
Function MakeGUID()
MakeGUID = Mid(Server.CreateObject("Scriptlet.TypeLib").GUID, 1, 38)
End Function
'Generate a unique OIK
Function GenerateGUID(ByRef Connection, ByVal TableName, ByVal GUIDFieldName)
Dim GUID, IsOk, SQL, RS
IsOk = False
Dim Counter
Counter = 0
'loop round generating new GUIDs until we've found one that hasn't been used yet!
While Not IsOk
Counter = Counter + 1
GUID = MakeGUID()
SQL = "SELECT [" & GUIDFieldName & "] FROM [" & TableName & "] WHERE [" & GUIDFieldName & "]='" & GUID & "'"
Response.Write SQL & "<BR>"
'Response.Flush
Set RS = ExecuteQuery(Connection, SQL, False, True)
If RS.EOF Then
'No matching GUID found, so it really *is* unique
IsOk = True
End If
Kill RS
Wend
'Response.Write "GenerateGUID took " & Counter & " attempts to generate a new GUID.<BR>"
GenerateGUID = GUID
End Function
Response.write GenerateGUID("Conn, CouponCode, CCode") '1
GenerateGUID("Conn, CouponCode, CCode") '2
%>
And now I get the following error useing number 1
SELECT [] FROM [] WHERE []='{8DA1D6A9-1C0F-4227-A211-550C4C747932}'
Microsoft VBScript runtime error '800a000d'
Type mismatch: 'ExecuteQuery'
/test.asp, line 33
And Line 33 is Set RS = ExecuteQuery(Connection, SQL, False, True)
so I know that there is a problem with
GenerateGUID("Conn, CouponCode, CCode")
when I use the above Number 2 I get this error
Microsoft VBScript runtime error '800a01c2'
Wrong number of arguments or invalid property assignment: 'GenerateGUID'
/test.asp, line 48
Edited by Crash1hd