123 Eng

Engineering the engineers™


Latest Jobs   Forum Map

 


Home

Source Codes

Engineering Colleges

BE Students

Training  Reports (updated)

Seminar Reports (updated

Placement Papers (updated)

Forums

   Computer Science / IT

   Electronics

   Electrical

   Mechanical

   Chemical

   Civil

   CAT / MBA

   GMAT / Foreign MBA

Latest Jobs

Engineering Jobs / Technical Jobs

Management Jobs

Sitemap

About-Us

Terms of use

Displaying  Source Code(s)  
 

 
Delete Record with SQL statement

--------------------------------------------------------------------------------

Description : SQL statements can be used to delete data as well.

<TITLE>dbdeletemany.asp</TITLE>
<body bgcolor="#FFFFFF">
<HTML>
<!--#include file="lib_errors.asp"-->
<%
On Error Resume Next
myDSN = "DSN=Student;uid=student;pwd=magic"
mySQL = "DELETE FROM authors WHERE au_id=200"

Set Conn = Server.CreateObject("ADODB.Connection")
conn.open myDSN

Conn.Execute mySQL,howmany
Response.Write "The statement " & mySQL & "<b> deleted " & howmany & " records</b><BR>
Call ErrorVBScriptReport("Deleting...")
Call ErrorADOReport(mySQL,conn)

Conn.Close
Set conn=Nothing
%>
</BODY>
</HTML>


The Error trapping library looks like this:

<%
Sub ErrorVBScriptReport(parm_msg)
If Err.number=0 Then
Exit Sub
End If
pad=" "
Response.Write "<b>VBScript Errors Occured!<BR>
Response.Write parm_msg & "</b><BR>
Response.Write pad & "Error Number= #<b>" & Err.number & "</b><BR>
Response.Write pad & "Error Desc.= <b>" & Err.description & "</b><BR>
Response.Write pad & "Help Context= <b>" & Err.helpcontext & "</b><BR>
Response.Write pad & "Help File Path=<b>" & Err.helpfile & "</b><BR>
Response.Write pad & "Error Source= <b>" & Err.source & "</b>
<hr>"
End Sub

Sub ErrorADOReport(parm_msg,parm_conn)
HowManyErrs=parm_conn.errors.count
If HowManyErrs=0 Then
Exit Sub
End If
pad=" "
Response.Write "<b>ADO Reports these Database Error(s) executing:<BR>
Response.Write SQLstmt & "</b><BR>
For counter= 0 To HowManyErrs-1
errornum=parm_conn.errors(counter).number
errordesc=parm_conn.errors(counter).description
Response.Write pad & "Error#=<b>" & errornum & "</b><BR>
Response.Write pad & "Error description=<b>"
Response.Write errordesc & "</b><p>"
Next
End Sub
%>
 

 

Contribute content or training reports / feedback / Comments
job placement papers
All rights reserved © copyright 123ENG