Active TopicsActive Topics  Display List of Forum MembersMemberlist  CalendarCalendar  Search The ForumSearch  HelpHelp
  RegisterRegister  LoginLogin


 One Stop Testing ForumTesting Tools @ OneStopTestingQuickTest Pro @ OneStopTesting

Message Icon Topic: QTP Script to Delete Database Data

Post Reply Post New Topic
Author Message
Mithi25
Senior Member
Senior Member
Avatar

Joined: 23Jun2009
Online Status: Offline
Posts: 288
Quote Mithi25 Replybullet Topic: QTP Script to Delete Database Data
    Posted: 25Nov2009 at 10:41pm
VBScript to delete a single row in database table.

We have table "EMP" in database "db"(Microsoft Access).

EMP Table has following data in it.


EMPNO EMPNAME EMPSAL
1 Lakshmi 30000
2 Laxmi 25000
3 Latha 15000

Dim con,rs

set con= CreateObject( "ADODB.Connection")

set rs =CreateObject("ADODB.Recordset")

con.provider="microsoft.jet.oledb.4.0"

con.open"d:\db.mdb"

rs.open "delete from EMP where empsal=15000 ",con

msgbox("Deleted")

Above script(code)will delete a row in database table(empsal=15000).

Output:

EMPNO EMPNAME EMPSAL
1 Lakshmi 30000
2 Laxmi 25000


To Delete all rows in database table just modify sql query as shown below

rs.open "delete from EMP where empsal=15000 ",con

Replace with

rs.open "delete from EMP ",con in the above code and the output will be

Output:

EMPNO EMPNAME EMPSAL



Post Resume: Click here to Upload your Resume & Apply for Jobs

IP IP Logged
Post Reply Post New Topic
Printable version Printable version

Forum Jump
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot delete your posts in this forum
You cannot edit your posts in this forum
You cannot create polls in this forum
You cannot vote in polls in this forum



This page was generated in 1.141 seconds.
Vyom is an ISO 9001:2000 Certified Organization

© Vyom Technosoft Pvt. Ltd. All Rights Reserved.

Privacy Policy | Terms and Conditions
Job Interview Questions | Placement Papers | Free SMS | Freshers Jobs | MBA Forum | Learn SAP | Web Hosting