Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
oracle 10g db connection
#3
Solved: 11 Years, 4 Months ago
Hi,

Use this below code to get the records and save it in excel file

Code:
var_Schema="QADB"
SchemaUserNme="GHA09"
SchemaPswd="GHA09"

Set conn=CreateObject("ADODB.Connection")
Set Rec=CreateObject("ADODB.Recordset")
Set obj=CreateObject("Excel.Application")
Set wrk=obj.Workbooks.Open("C:\Book1.xls")


conn.open "Driver={Microsoft ODBC for Oracle};Server="&var_Schema&";UID="&SchemaUserNme&";Password="&SchemaPswd&";"
SQL="Select * from  user_mas where role_id='FC'"
Rec.Open SQL,conn
R=1

Do until Rec.EOF
var1=Rec.Fields ("User_id")
Rec.MoveNext    
obj.Sheets(1).Cells(R,1).value=var1
'obj.Sheets(1).Cells(rowcount, 1).Value = var_user_id
R=R+1
Loop

Rec.Close
Set Rec=Nothing
conn.Close
Set conn=Nothing

obj.Application.activeworkbook.Save
obj.Application.activeworkbook.Close
obj.Application.Quit
Set wrk=Nothing
Set obj=Nothing
Reply


Messages In This Thread
oracle 10g db connection - by tirumal - 02-16-2011, 10:30 AM
RE: oracle 10g db connection - by Rekhapramod - 02-16-2011, 03:47 PM
RE: oracle 10g db connection - by surya_7mar - 02-17-2011, 09:43 PM

Possibly Related Threads…
Thread Author Replies Views Last Post
  [UFT] Connection String for Oracle robertosalemi 6 12,292 01-15-2016, 04:51 PM
Last Post: robertosalemi
  DB2 Connect connection with IE 11 SRP 1 2,621 12-18-2015, 12:41 PM
Last Post: vinod123
  IBM DB2 connection with VB script bmurali 2 10,917 12-18-2015, 12:38 PM
Last Post: vinod123
  Connection with HP ALM hachem 0 2,623 02-26-2015, 04:36 PM
Last Post: hachem
  “Cannot connect to 8822 (connection timed out)" Ikbal 0 2,138 12-08-2014, 11:38 PM
Last Post: Ikbal

Forum Jump:


Users browsing this thread: 2 Guest(s)