my code

- Utilizado nos indicadores CCO
- Executa código SQL

Snippet options

Download: Download snippet as execsqlssql-as-string.vbs.
Copy snippet: For this you need a free my code account.
Embed code : You will find the embed code for this snippet at the end of the page, if you want to embed it into a website or a blog!

Private Sub ExecSQL(sSQL As String)
    Dim conn As New ADODB.Connection
    Dim rs As New ADODB.Recordset
    Dim connString, strBD As String
    Dim nCampos As Long
    Dim sTabela As String
    Dim rRangeCheck As Range
    'On Error Resume Next
    'PRT#20130404: connString = "DRIVER={Microsoft ODBC for Oracle};UID=INDICADORES_CCO;PWD=ziyYNWjv;SERVER=EPTH01;"
    connString = ";Data Source=EPTH01;User Id=INDICADORES_CCO;Password=ziyYNWjv;"
    '*** DEBUG ***
    Worksheets("SQL").Range("C1").Value = sSQL
    conn.Open connString
    rs.CursorLocation = adUseServer
    rs.Open sSQL, conn ', adOpenForwardOnly, adLockReadOnly
    Set rs = Nothing
    Set conn = Nothing
End Sub

Create a free my code account now.

my code is a free service, which allows you to save and manage code snippes of any kind and programming language. We provide many advantages for your daily work with code-snippets, also for your teamwork. Give it a try!

Find out more and register now

You can customize the height of iFrame-Codes as needed! You can find more infos in our API Reference for iframe Embeds.