0

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
  • You are missing the assignment sign between your query and CommandText. Have you tried changing it to the following? `cmd.CommandText = "INSERT INTO TAR_DATA (TN_ID) VALUES (?)"` – S. Kerdel Jan 16 '18 at 09:40
  • Thank I looked at that code for a long time and never saw it. –  Jan 17 '18 at 14:01
  • I will repost my answer so that you could accept my answer and close your question, happy to hear this resolved your problem. – S. Kerdel Jan 18 '18 at 13:06

1 Answers1

0

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 (?)"

S. Kerdel
  • 90
  • 1
  • 9