[Last Call] Learn about multicloud storage options and how to improve your company's cloud strategy. Register Now

x
?
Solved

Connect to Oracle using Vbscript

Posted on 2006-06-13
4
Medium Priority
?
771 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
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
  • 2
4 Comments
 
LVL 15

Expert Comment

by:joeposter649
ID: 16895814
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 1200 total points
ID: 16900702
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
ID: 16942326
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
ID: 16957139
where is dat question??
i mean in which Topic area??
0

Featured Post

[Webinar] Lessons on Recovering from Petya

Skyport is working hard to help customers recover from recent attacks, like the Petya worm. This work has brought to light some important lessons. New malware attacks like this can take down your entire environment. Learn from others mistakes on how to prevent Petya like worms.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Preface This article introduces an authentication and authorization system for a website.  It is understood by the author and the project contributors that there is no such thing as a "one size fits all" system.  That being said, there is a certa…
There are two main kinds of selectors in CSS: One is base selector like h1, h2, body, table or any existing HTML tags.  For instance, the following rule sets all paragraphs (<p> elements) to red: (CODE) CSS also allows us to define our own custom …
Explain concepts important to validation of email addresses with regular expressions. Applies to most languages/tools that uses regular expressions. Consider email address RFCs: Look at HTML5 form input element (with type=email) regex pattern: T…
The viewer will learn the basics of jQuery, including how to invoke it on a web page. Reference your jQuery libraries: (CODE) Include your new external js/jQuery file: (CODE) Write your first lines of code to setup your site for jQuery.: (CODE)

650 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