Forums

ASP

This topic is locked

Deleting Multiple Records in One Table

Posted 25 Jul 2007 18:14:42
1
has voted
25 Jul 2007 18:14:42 dan stroh posted:
I am trying to set up a MS SQL database to delete all the tasks associated with a certain job in the database. To do this I created a command but for some reason it's telling me that the application variable is the wrong type. The value within job title is a numeric value

This is the error message.
ADODB.Command error '800a0d5d'
Application uses a value of the wrong type for the current operation.
/EmployeeDeleteAllTasks.asp, line 59

This is the code for the command.
<%
If Request("Submit" <> "" Then
Set Command1 = Server.CreateObject ("ADODB.Command"
Command1.ActiveConnection = MM_JobTracker_STRING
Command1.CommandText = "DELETE FROM dbo.[Task Info] WHERE [Task Info].[Job Title] = ?"
Command1.Parameters.Append Command1.CreateParameter("mmID", 5, 1, -1, MM_IIF(Request.QueryString ("Job ID", Request.QueryString ("Job ID", Command1__mmID & "")
Command1.CommandType = 1
Command1.CommandTimeout = 0
Command1.Prepared = true
Command1.Execute()
End If
%>

Any ideas on why this is happening? Help would be appreciated as this is for the internship that I am scheduled to complete in 3 days. Thanks.

Replies

Replied 25 Jul 2007 18:48:37
25 Jul 2007 18:48:37 Georgi Kralev replied:
Hi Dan,

<BLOCKQUOTE id=quote><font size=1 face="Verdana, Arial, Helvetica" id=quote>quote:<hr height=1 noshade id=quote>Command1.Parameters.Append Command1.CreateParameter("mmID", 5, 1, -1, MM_IIF(Request.QueryString ("Job ID", Request.QueryString ("Job ID", Command1__mmID & "")<hr height=1 noshade id=quote></BLOCKQUOTE id=quote></font id=quote><font face="Verdana, Arial, Helvetica" size=2 id=quote>

Your ADO Parameter parameter is expecting numeric value. Also, if the value of the parameter cannot be get from the URL it is used the one of "Command1__mmID"

Check if the value of "Job ID" which you get with QueryString is passed correctly and it correspond to the expected value.

I hope this will help you.

Regards,

Georgi Kralev

----------------------------------
Support - www.DMXzone.com
Replied 25 Jul 2007 19:02:57
25 Jul 2007 19:02:57 dan stroh replied:
George,

It should be expecting a numeric value. The field "Job Title" is represented by the "Job ID" in the table I am trying to delete from. The reason I am trying to do this is to be able to delete multiple records corresponding to a specific "Job ID". I am fairly certain that the "Job ID" value URL Parameter is passing correctly because when I use a Recordset to display information on the page it selects the right record to display using the "Job ID" value and is working. If this new information helps or if you happen to have other suggestions on how to accomplish this, I am all ears. Thanks again for your help.

Reply to this topic