Loop All Database In Server

Collapse
This topic is closed.
X
X
 
  • Time
  • Show
Clear All
new posts
  • Henry C. Wu

    Loop All Database In Server

    Hi all,
    I was wondering how can I loop through all the database in a
    particular server using ADODB into a combobox? Below is the code I
    tried using but didnt work, any hints/solutions for this anyone??

    Thanks,
    Henry


    Dim Cnxn As ADODB.Connectio n
    Dim rstSchema As ADODB.Recordset
    Dim strCnxn As String

    Cnxn = New ADODB.Connectio n

    'Sybase ASE ODBC Driver Connection string - uses DSN
    'strCnxn = "DSN=ase4141;UI D=" & ;PWD=;"
    strCnxn = "DSN=" & Me.cbxDataSourc e.Text & ";UID=" &
    Me.tbxLogin.Tex t & ";PWD=" & Me.tbxPassword. Text

    Cnxn.Open(strCn xn)

    rstSchema = Cnxn.OpenSchema (ADODB.SchemaEn um.adSchemaSche mata)

    Do Until rstSchema.EOF
    Debug.WriteLine (rstSchema)
    rstSchema.MoveN ext()
    Loop

    ' clean up
    rstSchema.Close ()
    Cnxn.Close()
    rstSchema = Nothing
    Cnxn = Nothing
  • Ken Tucker [MVP]

    #2
    Re: Loop All Database In Server

    Hi,

    Maybe this will help.



    Ken
    ----------------
    "Henry C. Wu" <henrycortezwu@ gmail.com> wrote in message
    news:44f096ca.0 502040347.7d3df 1d6@posting.goo gle.com...
    Hi all,
    I was wondering how can I loop through all the database in a
    particular server using ADODB into a combobox? Below is the code I
    tried using but didnt work, any hints/solutions for this anyone??

    Thanks,
    Henry


    Dim Cnxn As ADODB.Connectio n
    Dim rstSchema As ADODB.Recordset
    Dim strCnxn As String

    Cnxn = New ADODB.Connectio n

    'Sybase ASE ODBC Driver Connection string - uses DSN
    'strCnxn = "DSN=ase4141;UI D=" & ;PWD=;"
    strCnxn = "DSN=" & Me.cbxDataSourc e.Text & ";UID=" &
    Me.tbxLogin.Tex t & ";PWD=" & Me.tbxPassword. Text

    Cnxn.Open(strCn xn)

    rstSchema = Cnxn.OpenSchema (ADODB.SchemaEn um.adSchemaSche mata)

    Do Until rstSchema.EOF
    Debug.WriteLine (rstSchema)
    rstSchema.MoveN ext()
    Loop

    ' clean up
    rstSchema.Close ()
    Cnxn.Close()
    rstSchema = Nothing
    Cnxn = Nothing


    Comment

    Working...