CodeCharge Studio
search Register Login  

Web Reporting

Visually create Web Reports in PHP, ASP, .NET, Java, Perl and ColdFusion.
CodeCharge.com

YesSoftware Forums -> CodeCharge Studio -> ASP

 DELETE FROM Question....

Print topic Send  topic

Author Message
Sean

Posts: 39
Posted: 09/23/2004, 3:47 PM

I am trying to do a DELETE FROM on a table with no primary key or unique identifier. Since there is no way to delete a single record without that, I am trying to do a WHERE satement to narrow down the action, but I am having problems.

Code
-------------------
DBConnection1.Execute ("DELETE FROM Connections WHERE Page_ID = " & Request.QueryString("Page_ID") AND "Workstation_ID=" & Request.QueryString("Workstation_ID"))

When I run this, I get a Database Type mismatch string error. When I take out everything after the AND, it works fine, but doesn't narrow down the DELETE action to what I want it to delete.

Is it possible to DELETE from a table with multiple parameters? Or can I just DELETE using a single parameter?

Any help would be appreciated.

I am using CCS, ASP 3.0 & MSSQL
View profile  Send private message
eiden


Posts: 34
Posted: 09/26/2004, 10:27 AM

You can read about the DELETE SQL statement here:

http://www.w3schools.com/sql/sql_delete.asp
View profile  Send private message
Tuong Do
Posted: 09/27/2004, 9:38 PM

Hi Sean,

Your SQL string is wrong

Try this

If Page_ID and WorkStation_ID is of type integer

DBConnection1.Execute ("DELETE FROM Connections WHERE Page_ID = " &
Request.QueryString("Page_ID") & " AND Workstation_ID=" &
Request.QueryString("Workstation_ID"))

If Page_ID and WorkStation_ID is of type Text

DBConnection1.Execute ("DELETE FROM Connections WHERE Page_ID = '" &
Request.QueryString("Page_ID") & "' AND Workstation_ID='" &
Request.QueryString("Workstation_ID")) & "'"



I suggest (debugging purpose) you do the above command like this

Dim SQL
SQL = "Delete from ......"

DBConnection1.Execute(SQL)
' OR
'Response.write SQL
' Response.end
' To see your SQL statement when you have a problem

"Sean" <Sean@forum.codecharge> wrote in message
news:64153526670dd7@news.codecharge.com...
>I am trying to do a DELETE FROM on a table with no primary key or unique
> identifier. Since there is no way to delete a single record without that,
> I am
> trying to do a WHERE satement to narrow down the action, but I am having
> problems.
>
> Code
> -------------------
> DBConnection1.Execute ("DELETE FROM Connections WHERE Page_ID = " &
> Request.QueryString("Page_ID") AND "Workstation_ID=" &
> Request.QueryString("Workstation_ID"))
>
> When I run this, I get a Database Type mismatch string error. When I take
> out
> everything after the AND, it works fine, but doesn't narrow down the
> DELETE
> action to what I want it to delete.
>
> Is it possible to DELETE from a table with multiple parameters? Or can I
> just
> DELETE using a single parameter?
>
> Any help would be appreciated.
>
> I am using CCS, ASP 3.0 & MSSQL
> ---------------------------------------
> Sent from YesSoftware forum
> http://forums.codecharge.com/
>

Sean

Posts: 39
Posted: 09/28/2004, 7:03 PM

Thanks Tuong, that did it. I had it that way in the beginning and it just didn't seem "right", but I never tested it.

It's working now. :-)
View profile  Send private message

Add new topic Subscribe to topic   


These are Community Forums for users to exchange information.
If you would like to obtain technical product help please visit http://support.yessoftware.com.

Internet Database

Visually create Web enabled database applications in minutes.
CodeCharge.com

Home   |    Search   |    Members   |    Register   |    Login


Powered by UltraApps Forum created with CodeCharge Studio
Copyright © 2003-2004 by UltraApps.com  and YesSoftware, Inc.