Advertisement

07.27.2008 at 03:44PM PDT, ID: 23599381
[x]
Attachment Details
[x]
The Solution Rating System

With so many solutions, how can you tell which solutions are most likely to help you and which ones are not? To provide you with a tool to use, we rate our solutions based on various elements that most accurately determine if a solution is a quality solution. To explain what factors affect the solution rating, here are the elements we take into consideration when formulating our solution rating.

  • The Grade of the Solution
  • The Zone Rank of the Expert Providing the Solution
  • The Number of Author and Expert Comments
  • The Number of Experts Contributing
  • The Feedback of the Community

Your Input Matters
Because of the way the system is set up, the most important variable in this equation is you. As a member of Experts Exchange, you are able to cast your vote on the quality of the solutions in regard to how complete, accurate, helpful and easy to understand each solution is. When you provide your feedback, each rating is adjusted accordingly. So, if you see a solution that has a poor rating that you think is a good solution, let us know by rating it. As you do, the rating will be adjusted and will become more accurate for other members of our site.

If you have any suggestions that you would like to make for our rating system, please ask a question in the Suggestions Zone of Community Support.

Thank you!

6.9

VB script extract data from Oracle datadase into excel

Asked by Waku2004 in Visual Basic Programming, Oracle 10.x, VB Script

Tags: , , ,

Hi Guys,
              I am a real beginner and I need to extract some information from the oracle database using a vb script and then extract to excel. What I want to do is run a SQL statement to locate all the projects and then using another SQL statement to find out the last login date to the project. and extract that to a CSV or XLS format. Please if anyone can help me out?

I have a sample below:

Dim strConnect
Dim adoConnection
Dim adoRecordset
Dim strSQL
Dim strResults
Dim rs As Recordset



strSQL = "SELECT SELECT DOMAIN_NAME, PROJECT_NAME, DB_NAME, PHYSICAL_DIRECTORY FROM QCSITEADMIN_DB.PROJECTS;

Set com = tdc.Command
com.CommandText = "SELECT MAX(START_TIME) FROM QCSITEADMIN_DB.SESSIONS_HISTORY where PROJECT_NAME = 'strSQL' com.Execute

For i = 0 To rs.RecordCount 'note: Recordset count start from 0!
   If rs.EOR = False Then
      rs.Next
    End If
Next  



Set adoConnection = CreateObject("ADODB.Connection")

strConnect ="Driver={Microsoft ODBC for Oracle}; " & _
         "CONNECTSTRING=(DESCRIPTION=" & _
         "(ADDRESS=(PROTOCOL=TCP)" & _
         "(HOST=10.21.42.218)(PORT=1521))" & _
         "(CONNECT_DATA=(SERVICE_NAME=TCR_SA3KNX10DB))); uid=TD_ADMIN_RO;pwd=TD_ADMIN_RO;"

adoConnection.Open strConnect
Set adoRecordset = CreateObject("ADODB.Recordset")
adoRecordset.ActiveConnection = adoConnection
adoRecordset.Source = strSQL
adoRecordset.Open
Do Until adoRecordset.EOF
          strResults = adoRecordset.Fields(0).Value
           msgbox strResults
           adoRecordset.MoveNext
Loop

adoRecordset.Close  
adoConnection.Close

Const xlShiftDown = -4121
 
'The TSV file to be converted
strInput = "c:\temp.txt"
 
'The Excel file to be created
strOutput = "c:\temp.xls"
 
'The column headings
arrColumns = array("Project Name","Date of Last QC login to Project","NAS total space of *.bmp files","Latest modified date of *.bmp files")
 
Set objExcel = CreateObject("Excel.Application")
objExcel.DisplayAlerts = FALSE
objExcel.Visible = FALSE
 
Set objWorkbook = objExcel.Workbooks.Open(strInput)
Set objWorksheet = objWorkbook.Worksheets(1)
 
intRow = objExcel.ActiveCell.Row
intColumn = objExcel.ActiveCell.Column
Set objRange = objWorksheet.Cells(intRow, intColumn).EntireRow
objRange.Insert(xlShiftDown)
 
For Each strColumn in arrColumns
    objExcel.Cells(1, intColumn).Value = strColumn
    intColumn = intColumn + 1
Next
 
objExcel.ActiveWorkbook.SaveAs strOutput, 1
objExcel.ActiveWorkbook.Close
objExcel.Application.Quit
Start Free Trial
[+][-]07.27.2008 at 06:57PM PDT, ID: 22100331

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.27.2008 at 08:38PM PDT, ID: 22100577

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.27.2008 at 08:40PM PDT, ID: 22100580

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.27.2008 at 09:31PM PDT, ID: 22100698

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.28.2008 at 08:53PM PDT, ID: 22108552

At Experts Exchange, members can ask their questions to thousands of technology professionals, also known as Experts. Experts compete and collaborate to answer those questions by leaving comments like this one.

Start your 7-day free trial to view this Expert Comment or ask the Experts your question.

 
[+][-]07.28.2008 at 10:39PM PDT, ID: 22108849

Often, when Experts are collaborating with members who have asked questions, they will request additional information about the problem. Askers respond with an author comment like this one.

Start your 7-day free trial to view this Author Comment or ask the Experts your question.

 
[+][-]07.29.2008 at 08:46AM PDT, ID: 22112660

View this solution now by starting your 7-day free trial. Setting up your free trial is quick, easy, and secure. We will return you to this solution, unlocked, when you're done.

 

About this solution

Zones: Visual Basic Programming, Oracle 10.x, VB Script
Tags: Vb script, VB script, excel 2003, n/a
Sign Up Now!
Solution Provided By: wildboy85
Participating Experts: 1
Solution Grade: B
 
 
 
Loading Advertisement...
20080716-EE-VQP-32 / EE_QW_2_20070628