|
 |
asp_databases thread: How to delete a record from SQL database
Message #1 by "Kalwinder" <K965408@k...> on Tue, 19 Dec 2000 12:31:26 -0000
|
|
Anyone know how to delete a single record from a Microsoft SQL Server
Database.
So, far, I open a recordset and select one record. I then delete that
object I create which in return deletes the selected record. Now this
works fine to a Microsoft Access database, but when applied to a Microsoft
SQL database, I get an ASP error message saying that the function cannot
be performed.
Anyone, successfull in deleting a single record in a SQL database or know
how this is possible?????
Thanks for your help
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #2 by PERRETTA Franco <Franco.PERRETTA@c...> on Tue, 19 Dec 2000 14:07:17 +0100
|
|
Dear,
In SQL the situation Is different from ACCESS .mdb. In Sql you
should use the sql language to DELETE; ADDNEW (Update);
Here the exemple to delate a record.
------------------------------------------------------------------
Set MyConn = Server.CreateObject("ADODB.Connection")
MyConn.Open "Provider=SQLOLEDB;DRIVER=SQL
Server;SERVER=acdc;DATABASE=dct_manage;UID=dct_manage;PWD=0458"
Set Rs = Server.CreateObject("ADODB.Recordset")
qd = "Delete From IndivTimeRec WHERE DateSheet ='"& TempDateSheet &"'"
Set Rs=MyConn.Execute(qd)
---------------------------------------------------
Here to Update a record:
qd = "Update IndivTimeRec Set DateSheet = '" & Replace(TempDateSheet,
"'","''") & "'"
Set Rs=MyConn.Execute(qd)
Franco
___________________________________
Perretta Franco
Council of Europe
Department of Information Technology
Information Access Unit
67075 Strasbourg Cedex
tel: +33 (0)3 88 41 22 18 fax: +33 (0)3 88 41 27 39
mailto:franco.perretta@c...
http://www.coe.int
-----Original Message-----
From: Kalwinder [mailto:K965408@k...]
Sent: Tuesday 19 December 2000 13:31
To: ASP Databases
Subject: [asp_databases] How to delete a record from SQL database
Anyone know how to delete a single record from a Microsoft SQL Server
Database.
So, far, I open a recordset and select one record. I then delete that
object I create which in return deletes the selected record. Now this
works fine to a Microsoft Access database, but when applied to a Microsoft
SQL database, I get an ASP error message saying that the function cannot
be performed.
Anyone, successfull in deleting a single record in a SQL database or know
how this is possible?????
Thanks for your help
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #3 by Stephane_Dattenny@D... on Tue, 19 Dec 2000 07:10:12 -0600
|
|
Hi
Instead use the delete sql statement directly:
"DELETE FROM table_name WHERE primary_key=value"
Best regards / Cordialement
Stephane Dattenny
Dell Computers - EMEA IT - VB and Web developer
Phone: +33 (0)4 99 75 49 88
-----Original Message-----
From: Kalwinder [mailto:K965408@k...]
Sent: Tuesday, December 19, 2000 1:31 PM
To: ASP Databases
Subject: [asp_databases] How to delete a record from SQL database
Anyone know how to delete a single record from a Microsoft SQL Server
Database.
So, far, I open a recordset and select one record. I then delete that
object I create which in return deletes the selected record. Now this
works fine to a Microsoft Access database, but when applied to a Microsoft
SQL database, I get an ASP error message saying that the function cannot
be performed.
Anyone, successfull in deleting a single record in a SQL database or know
how this is possible?????
Thanks for your help
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #4 by Gregory_Griffiths@c... on Tue, 19 Dec 2000 13:12:36 +0000
|
|
why not just issue an SQL delete statement.
> -----Original Message-----
> From: K965408@k... [mailto:K965408@k...]
> Sent: 19 December 2000 12:31
> To: asp_databases@p...; K965408@k...
> Subject: [asp_databases] How to delete a record from SQL database
>
>
> Anyone know how to delete a single record from a Microsoft SQL Server
> Database.
>
> So, far, I open a recordset and select one record. I then delete that
> object I create which in return deletes the selected record. Now this
> works fine to a Microsoft Access database, but when applied
> to a Microsoft
> SQL database, I get an ASP error message saying that the
> function cannot
> be performed.
>
> Anyone, successfull in deleting a single record in a SQL
> database or know
> how this is possible?????
>
> Thanks for your help
>
---
FREE WEB DEVELOPMENT CODE, CONTENT, AND INSIGHTS
IN YOUR INBOX!
Get the latest and best HTML, XML, and JavaScript tips, tools, and
developments from the experts. Sign up for one or more of EarthWeb's
FREE IT newsletters at http://www.earthweb.com today!
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
Message #5 by "Colin Gourlay" <colin.gourlay@c...> on Tue, 26 Dec 2000 11:13:13 -0000
|
|
If you are using ADO try using the 'delete' method and then, optionally,
using the current record constant as an argument.
Alternatively, just execute a SQL statement (DELETE) within your code.
Hope this helps.
Regards
Colin Gourlay BSc
CG Systems
http://www.csystems.org.uk
-----Original Message-----
From: Kalwinder [mailto:K965408@k...]
Sent: 19 December 2000 12:31
To: ASP Databases
Subject: [asp_databases] How to delete a record from SQL database
Anyone know how to delete a single record from a Microsoft SQL Server
Database.
So, far, I open a recordset and select one record. I then delete that
object I create which in return deletes the selected record. Now this
works fine to a Microsoft Access database, but when applied to a Microsoft
SQL database, I get an ASP error message saying that the function cannot
be performed.
Anyone, successfull in deleting a single record in a SQL database or know
how this is possible?????
Thanks for your help
---
NEED TECHNICAL TIPS, TOOLS, AND INSIGHTS? Is FREE okay?
Visit EarthWeb for the latest in IT Management, Software Development,
Web Development, Networking & Communications, and Hardware & Systems.
Click on http://www.earthweb.com for FREE articles, tutorials,
and discussions from the experts.
---
You are currently subscribed to asp_databases as: $subst('Recip.EmailAddr')
To unsubscribe send a blank email to leave-asp_databases-$subst('Recip.MemberIDChar')@p2p.wrox.com
|
|
 |