Print Page | Close Window

QTP Script to Insert Values Into Database Table

Printed From: One Stop Testing
Category: Testing Tools @ OneStopTesting
Forum Name: QuickTest Pro @ OneStopTesting
Forum Discription: QuickTest Pro is a fresh approach to automated software and application testing that addresses testing needs of both business analysts and Quality Assurance professionals.
URL: http://forum.onestoptesting.com/forum_posts.asp?TID=7375
Printed Date: 18Dec2024 at 2:07am


Topic: QTP Script to Insert Values Into Database Table
Posted By: Mithi25
Subject: QTP Script to Insert Values Into Database Table
Date Posted: 25Nov2009 at 10:40pm
VBScript to insert values 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
http://sqlqueriescollection.blogspot.com/ -
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 "insert into EMP(empno,empname,empsal) values(4,'Lakshmi',40000)",con

msgbox("Inserted")

Above script(code)will insert values in database table.


Output:

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


-------------
http://www.quick2sms.com - Send Unlimited FREE SMS to Any Mobile Anywhere in INDIA,
Click Here



Print Page | Close Window