Solved

Connect to Oracle using Vbscript

Posted on 2006-06-13
4
763 Views
Last Modified: 2008-02-01
I am trying to query oracle using vbscript for testing. Can anyone drop in some code? also, how will I embed this code into quick test professional, which I am using for automated testing.
0
Comment
Question by:suyoggupta
  • 2
4 Comments
 
LVL 15

Expert Comment

by:joeposter649
Comment Utility
Dim objConnection
Set objConnection = CreateObject("ADODB.Connection")
objConnection.ConnectionString = "Provider=OraOLEDB.Oracle;Data Source=MyOracleDB;User Id=myUsername;Password=myPassword
objConnection.ConnectionTimeout = 0
objConnection.Open
0
 
LVL 8

Accepted Solution

by:
hiteshgupta1 earned 300 total points
Comment Utility
Following is a smple code which i wrote while i was learning QTp
i hope it would help u
it illustrates the


Set oXLSheet=createobject ("Excel.Application")
If isnull (oXLSheet) Then
Reporter.ReportEvent micFail ("error starting Excel")
End If

oXLSheet.visible=True
oXLSheet.workbooks.Add()
Set XLSht = oXLSheet.Sheets.Item(1)


dbconnectstring = "" Add your connection string here
Dim dbconnect, dbresults
Set dbconnect = CreateObject("ADODB.Connection")
Set dbresult = CreateObject("ADODB.Recordset")

dbconnect.Open (dbconnectstring)
Dim thissql, numrows
thissql = "select * from ...."
dbresult.Open (thissql), dbconnect

For intCount = 0 To dbresult.Fields.Count - 1
XLSht.Cells(1, intCount + 1).Value = dbresult.Fields(intCount).Name
If Not dbresult.BOF Then
dbresult.MoveFirst
End If

intRow = 1
Do Until dbresult.EOF
XLSht.Cells(intRow + 1, intCount + 1).Value = dbresult.Fields(intCount).Value
dbresult.MoveNext
intRow =intRow+1
Loop
Next

oXLSheet.ActiveWorkBook.SaveAs("C:\test.xls")
Set dbresult = nothing
dbconnect.close
Set dbconnect = nothing
0
 

Author Comment

by:suyoggupta
Comment Utility
Thank you, this is perfect..!! Hitesh, if you get time, please have a look at my latest question n plink-vbscript also..it is very difficult..
0
 
LVL 8

Expert Comment

by:hiteshgupta1
Comment Utility
where is dat question??
i mean in which Topic area??
0

Featured Post

Maximize Your Threat Intelligence Reporting

Reporting is one of the most important and least talked about aspects of a world-class threat intelligence program. Here’s how to do it right.

Join & Write a Comment

Suggested Solutions

Most of the sites are being standardized with W3C Web Standards. W3C provides lot of web standard services to the web. They have the web specification, process and documentation for all the web standards. You can apply HTML, CSS and Accessibility st…
It's sometimes a bit tricky to use date functions in Oracle BPEL. I'll explain quickly how you can add N days to the current date. In a BPEL process this can be useful, and you can adapt it to fit your needs. First of all, let's see how to add 1 …
Viewers will learn about basic arrays, how to declare them, and how to use them. Introduction and definition: Declare an array and cover the syntax of declaring them: Initialize every index in the created array: Example/Features of a basic arr…
The viewer will learn how to look for a specific file type in a local or remote server directory using PHP.

762 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question

Need Help in Real-Time?

Connect with top rated Experts

9 Experts available now in Live!

Get 1:1 Help Now