i have a problem about fields of executed query in vba

Collapse
X
 
  • Time
  • Show
Clear All
new posts
  • cem babaeren
    New Member
    • Aug 2010
    • 1

    i have a problem about fields of executed query in vba

    i have two problems:

    1) when i execute this query in sql 2005; i get more than 10.000 results. However i get only 1087 results in vba excel. why would it be so?

    2) i have three collections defined in the code. and want to fill them with the corresponding fields in the query.. that's; tarih_list as field(1); vkgs_list as field(2); getiri_list as field(3).. how can i do that?

    thanks in advance..

    Code:
    ---
    Private Sub CommandButton1_Click()
    
    Dim MyConnObj As New ADODB.Connection
    Dim myRecSet As New ADODB.Recordset
    Dim vkgs_list As New Collection
    Dim getiri_list As New Collection
    Dim tarih_list As New Connection
    
    MyConnObj.Open "Provider = sqloledb;" & "Data Source=192.168.0.99;" & "Initial Catalog=BDDK_SERVER;" & "User ID=RISKUSER;" & "Password=RISKUSER;"
    sqlStr = "select TARIH_DT, VKGS, GETIRI from VERIMEGRISI where VERIMEGRISI = 'USD.GOV' AND TARIH_DT > 20080501 ORDER BY TARIH_DT DESC, VKGS ASC"
    
    myRecSet.Open sqlStr, MyConnObj, adOpenKeyset
    
    For i = 1 To myRecSet.RecordCount
    '??
    '??
    '??
    
    Next
    MyConnObj.Close
    End Sub
    
    ---
    Last edited by Niheel; Aug 20 '10, 03:36 PM.
Working...