Parameterization is required for this code

toravietl

New member
Joined
Mar 7, 2014
Messages
7
Reaction score
0
Points
0
Hi Team,

Actually I gone through the below code it is working file,It will connect to database and retrieve table results in sheet.
Here we are providing table name in Sqlquery so it is picking only that table details(table1)
Instead of that using the same code it will take table names that is present in sheet1 from A1 to A6 and give the results of those tables data in another sheet.
Code:
 Dim strSQL As String
 Dim strResult As String
 Dim OraDynaSet As Object
 Dim i As Integer
 Worksheets.Add
 strScript = "select tablenames, OWNER from ALLTABLES  group by tablenames where tablenames in('table1')

  Set OraDynaSet = objDataBase.DBCreateDynaset(Script, 0&) 

 If OraDynaSet.RecordCount > 0 then
        OraDynaSet.MoveFirst
        For i = 1 to OraDynaSet.RecordCount
                ActiveSheet.Cells(i,1) = OraDynaSet.Fields(0).Value 
        ActiveSheet.Cells(i,2) = OraDynaSet.Fields(1).Value
        OraDynaSet.MoveNext
    Next i
 End if
 
Back
Top