?
Solved

Connect to Oracle using Vbscript

Posted on 2006-06-13
4
Medium Priority
?
770 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

Secure Your WordPress Site: 5 Essential Approaches

WordPress is the web's most popular CMS, but its dominance also makes it a target for attackers. Our eBook will show you how to:

Prevent costly exploits of core and plugin vulnerabilities
Repel automated attacks
Lock down your dashboard, secure your code, and protect your users

Question has a verified solution.

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

Browsers only know CSS so your awesome SASS code needs to be translated into normal CSS. Here I'll try to explain what you should aim for in order to take full advantage of SASS.
SASS allows you to treat your CSS code in a more OOP way. Let's have a look on how you can structure your code in order for it to be easily maintained and reused.
The viewer will receive an overview of the basics of CSS showing inline styles. In the head tags set up your style tags: (CODE) Reference the nav tag and set your properties.: (CODE) Set the reference for the UL element and styles for it to ensu…
The viewer will learn how to create a basic form using some HTML5 and PHP for later processing. Set up your basic HTML file. Open your form tag and set the method and action attributes.: (CODE) Set up your first few inputs one for the name and …
Suggested Courses

752 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