Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...


how we connect oracle or sql data server database to qtp

Answers were Sorted based on User's Feedback



how we connect oracle or sql data server database to qtp..

Answer / kamal

I think, in database testing we connect oracle or sql data
server database by using odbc(connectivity).

if it's wrong plz give correct answer

Is This Answer Correct ?    5 Yes 0 No

how we connect oracle or sql data server database to qtp..

Answer / kiran

Dim conConnection As New ADODB.Connection
Dim cmdCommand As New ADODB.Command
Dim rstRecordSet As New ADODB.Recordset


'Defines the connection string for the Connection. Here we have used fields
'Provider, Data Source and Mode to assign values to the properties
' conConnection.Provider and conConnection.Mode

conConnection.ConnectionString = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" & _
App.Path & "\" & "database.mdb;Mode=Read|Write"


'Define the location of the cursor engine, in this case we are opening an Access database
'and adUseClient is our only choice.

conConnection.CursorLocation = adUseClient


'Opens our connection using the password "Admin" to access the database. If there was no password
'protection on the database this field could be left out.

conConnection.Open


'Defines our command object

' .ActiveConnection tells the command to use our newly created command object.
' .CommandText tells the command how to get the data, in this case the command
' will evaluate the text as an SQL string and we will return all
' records from a table called tabTestTable
' .CommandType tells the command to evaluate the .CommandText property as an SQL string.

With cmdCommand
.ActiveConnection = conConnection
.CommandText = "SELECT * FROM tabTestTable;"
.CommandType = adCmdText
End With

'Defines our RecordSet object.

' .CursorType sets a static cursor, the only choice for a client side cursor
' .CursorLocation sets a client side cursor, the only choice for an Access database
' .LockType sets an optimistic lock type
' .Open executes the cmdCommand object against the data source and stores the
' returned records in our RecordSet object.

With rstRecordSet
.CursorType = adOpenStatic
.CursorLocation = adUseClient
.LockType = adLockOptimistic
.Open cmdCommand
End With

'Firstly test to see if any records have been returned, if some have been returned then
'the .EOF property of the RecordSet will be false, if none have been returned then the
'property will be true.

If rstRecordSet.EOF = False Then

'Move to the first record

rstRecordSet.MoveFirst

'Lets move through the records one at a time until we reach the last record
'and print out the values of each field

Do

'Access the field values using the fields collection and print them to a message box.
'In this case I do not know what you might call the columns in your database so this
'is the safest way to do it. If I did know the names of the columns in your table
'and they were called "Column1" and "Column2" I could reference their values using:

' rstRecordSet!Column1
' rstRecordSet!Column2


MsgBox "Record " & rstRecordSet.AbsolutePosition & " " & _
rstRecordSet.Fields(0).Name & "=" & rstRecordSet.Fields(0) & " " & _
rstRecordSet.Fields(1).Name & "=" & rstRecordSet.Fields(1)

'Move to the next record

rstRecordSet.MoveNext
Loop Until rstRecordSet.EOF = True

'Add a new record

With rstRecordSet
.AddNew
.Fields(0) = "New"
.Fields(1) = "Record"
.Update
End With

'Move back to the first record and delete it

rstRecordSet.MoveFirst
rstRecordSet.Delete
rstRecordSet.Update


'Close the recordset

rstRecordSet.Close
Else
MsgBox "No records were returned using the query " & cmdCommand.CommandText
End If

'Close the connection

conConnection.Close

'Release your variable references

Set conConnection = Nothing
Set cmdCommand = Nothing
Set rstRecordSet = Nothing
End Sub

Is This Answer Correct ?    0 Yes 0 No

how we connect oracle or sql data server database to qtp..

Answer / srinivasmohan

I think, in database testing we connect oracle or sql data
server database by using ADODB.connection

Is This Answer Correct ?    0 Yes 1 No

Post New Answer

More QTP Interview Questions

How to handle Recovery scenario in QTP. give detailed explanation about recovery scenario.

4 Answers   Arsin Systems,


Where to use Property Let, Property Get, Property Set in UFT

0 Answers  


How to Test Dynamic links ?

4 Answers   Wipro,


Test Life cycle starts IS it Requirments stage or Test Initiation?

1 Answers  


what is web application and client server application.is there any difference ?

1 Answers   Wells Fargo,


How you are maintaining shared object repository in your team or your project?help me plz

1 Answers   CTS,


how can i call function (which has link with excell sheet at a remote location) within another function

0 Answers  


What is the use of "Registeruserfunc" when should we use it? Note:Please do not copy paste the date from QTP help. I tryed it.But I don't Understand where should we use exactly.

5 Answers   Livetek,


give me descriptive programing code sample flight application in qtp?

8 Answers   CA, IBM,


what is diff b/w function and action?

8 Answers   VSoft,


how do you find the number of occurences of string QTP from the expression , " QTP+QTP=2QTP"

5 Answers   IBM,


How do I modify a value of an elemnt which is not the first one in xml file? My sample XML file is like: <Environment> <Variable> <Name>Name</Name> <Value>Uday Kumar</Value> </Variable> <Variable> <Name>Designation</Name> <Value>Senior Software Engineer</Value> </Variable> </Environment> for example, I'd like to change the value 'Senior Software Engineer' to 'Student' in the second element. How do I do it in QTP?

3 Answers   QualiTest,


Categories