Discussion Locked

Find My Error : ASP & VB Script Code

0 helpful
4 replies
Closed to new repliesThis discussion is closed. It stays readable, but it takes no new replies.

Find the error ("Wrong number of arguments or invalid property assignment") on line 17 (denoted by "L17")...
L1 <%@ LANGUAGE="VBSCRIPT" %>
L2
L3
L4
L5 <%
L6 Dim strQ, strW
L7 Dim objConn, objRS
L8 Dim objCmd, objParam
L9 Dim FirstField

L10 Set objConn = Server.CreateObject("ADODB.Connection")
L11 objConn.Open "SQL Trial Test", "adams2", "darkwood"
L12 strQ = "SELECT * FROM PNote"
L13 FirstField ="iComKey"
L14 sSql = "sp_NextKey '" & FirstField & "'"
L15 strP = objConn.Execute(sSql)
L16 strW = "INSERT INTO PNote (icomkey, ibuskey, crep, cactivity, cproduct, mcomment, lclosed, dcomment, cudf1, cudf2, cudf3) VALUES ('"
L17 strW = strW & strP & "','104','JOHN','Appointment','Other','mupup','26-03-07','1','3','7','7')"
L18 objConn.Execute strW
L19 set objRS = objConn.Execute(strQ)
%>
...code continues to irrelevant sections...

4 replies

by shadowtraitor

hey your in your insert statement you are inserting StrW which is currently holds a string which holds the insert statement.
Another thing is that the date should be enclosed in pound signs # datestring #
it is also not necessary to enclose the the SQL string in braces it is just

set strP = objConn.Execute sSQL
set objRS = objConn.Execute strQ

It probably should be
strW = "INSERT INTO PNote (icomkey, ibuskey, crep, cactivity, cproduct, mcomment, lclosed, dcomment, cudf1, cudf2, cudf3)
VALUES ('" & strP & "','104','JOHN',
'Appointment','Other','mupup','#26-03-07#','1','3','7','7')"

by lyxx

In line L17 You try connect strP to line, but it's not a string, you must describe, what field you want like

strP.Fields("Name_of_field") OR if stored procedure returned one result, you can write

strP.Fields(0)

This discussion is closed to new replies.