Wrong number of arguments or invalid property assignment: 'CommandText'

718 views Asked by At

I have the following code in a Classic ASP website that I have to update the SQL statements and for some reason I keep getting the error Wrong number of argument or invalid property assignment 'Command Text. I have tried changing the createParameter to the first line of code but that does not work. So I changed it to the line in the second CreateParameter but neither one works. Any help would be greatly appreciated.

cmd.Parameters.Append cmd.CreateParameter("@parm1",adSingle,adParamInput,,tailno)  


set cmd = Server.CreateObject("ADODB.Command")
cmd.ActiveConnection = tadsdb
cmd.CommandText "INSERT INTO TAR_DATA (TN_ID) VALUES (?)"
cmd.CommandType = adCmdText
cmd.Parameters.Append cmd.CreateParameter("@parm1",3,1,,tailno)
cmd.Execute
1

There are 1 answers

0
S. Kerdel On

cmd.CommandText doesn't take an argument but requires an assignment.

To resolve your problem you should add the '=' operator between the CommandText and your given query.

This line:

cmd.CommandText "INSERT INTO TAR_DATA (TN_ID) VALUES (?)"

Should become:

cmd.CommandText = "INSERT INTO TAR_DATA (TN_ID) VALUES (?)"