Solved

Connect to Oracle using Vbscript

Posted on 2006-06-13
4
769 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 300 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

On Demand Webinar - Networking for the Cloud Era

This webinar discusses:
-Common barriers companies experience when moving to the cloud
-How SD-WAN changes the way we look at networks
-Best practices customers should employ moving forward with cloud migration
-What happens behind the scenes of SteelConnect’s one-click button

Question has a verified solution.

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

When you work with shopping cart / ecommerce relates web sites, you need to pass the certain form post details to the payment gateway process page with required details for the products items you give to order. Also you may need to track the ordered…
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.
Viewers will learn one way to get user input in Java. Introduce the Scanner object: Declare the variable that stores the user input: An example prompting the user for input: Methods you need to invoke in order to properly get  user input:
The viewer will learn how to dynamically set the form action using jQuery.

717 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