Loading ...
Sorry, an error occurred while loading the content.

[Clip] Re: Interesting Database Question

Expand Messages
  • Erich Ruff
    ... From: Clint Tredway [mailto:CTredway@swst.com] Sent: Mittwoch, 1. März 2000 22:27 To: ntb-clips@egroups.com Subject: [Clip] Re: Interesting Database
    Message 1 of 11 , Mar 1, 2000
    View Source
    • 0 Attachment
      -----Original Message-----
      From: Clint Tredway [mailto:CTredway@...]
      Sent: Mittwoch, 1. März 2000 22:27
      To: 'ntb-clips@egroups.com'
      Subject: [Clip] Re: Interesting Database Question


      Thanks for the help guys. Here is exactly what I want to do.

      As a web developer I write many Insert, Update, and Delete Statements. I
      want to write a clip that will give me a list of tables from a selected
      database. Then I want to choose the table and the be given a list of columns
      in the table that I chose. Then I will choose the columns that I want and
      then click "OK" and have my insert or update statement written out the
      proper format.

      If this is possible, after this clip is written I want to do the same thing
      for stored procedures. I know that I can write this type of 'utility' in
      Visual Basic, but I would rather do it throught note tab so I don't have to
      go back and forth between apps.

      I don't think a text file will work in this situation.

      Thanks again guys.

      Did you consider to use Windows Scripting Host WSH (VBScript). You can write
      Scripts in NTP and you can access MSAccess :-)) and SQL-Server with ADO, the
      new MS Database prgramming layer (activeX). VBScripts can be Run from within
      NoteTabPro. You can persist ADO-Recordsets to files on disk and use them
      without Access, getting Datas with VBScript.

      There is an interesting list you can subscribe for WSH-Programming at
      http://wsh.glazier.co.nz
      with a lot of samples which will get you started.

      Just another possibility

      Erich

      ------------------------------------------------------------------------
      Registering a domain name is quick and easy.
      http://click.egroups.com/1/1611/3/_/2798/_/951946174/

      -- Talk to your group with your own voice!
      -- http://www.egroups.com/VoiceChatPage?listName=ntb-clips&m=1
    • Grant
      ... write ... the ... within ... Yeah I m a fan of using WSH from within Notetab cause you can grab the wsh output with the ^$GetOutput( Command )$. method.
      Message 2 of 11 , Mar 3, 2000
      View Source
      • 0 Attachment
        > Did you consider to use Windows Scripting Host WSH (VBScript). You can
        write
        > Scripts in NTP and you can access MSAccess :-)) and SQL-Server with ADO,
        the
        > new MS Database prgramming layer (activeX). VBScripts can be Run from
        within
        > NoteTabPro. You can persist ADO-Recordsets to files on disk and use them
        > without Access, getting Datas with VBScript.
        >
        > There is an interesting list you can subscribe for WSH-Programming at
        > http://wsh.glazier.co.nz
        > with a lot of samples which will get you started.

        Yeah I'm a fan of using WSH from within Notetab cause you can grab the wsh
        output with the ^$GetOutput("Command")$. method. This command has been
        reworked by Eric in ver 4.8 to give even a faster response.

        Try this clip to see what version of wsh(if any) you have installed.

        H=wshVersion
        ^!TextToFile "^$GetScriptPath$temp.js" WScript.Echo(WScript.Version)
        ^!Info ^$GetOutput(cscript "^$GetScriptPath$temp.js" file://NoLogo)$

        As Erich suggests using ADO is the way to go however you can use any
        scripting language as seen in the example above and not just vbs with the
        wsh. Once you have created a DSN entry for your database using ADO is not
        that difficult
        Check out this site
        http://www.winscripter.com/
        Which has a section "Samples interacting with ODBC databases". Which will
        give you some idea.
        Remember The Wsh"echo" can be grabbed by notetab with the
        ^$GetOutput("Command")$

        There are some good books on ADO. check out http://www.wrox.com
        You can also get heaps of examples from all those ASP sites out there on how
        to use ADO
        You just need to hack the scripts a bit (note javascript examples below not
        vbs)
        So instead of
        var objRec = Server.CreateObject('ADODB.Recordset')
        You will have
        var objRec = new ActiveXObject('ADODB.Recordset');
        And of course can hack those ASP Response .Write() methods to the WSH
        equivalent
        WScript.Echo(); methods.

        The best way I have found to work with WSH is Like the Notetab Perl examples
        is to create 2 clips.
        a loader clip and the actual script.
        H=Loader
        ^!Set %js%="ThisScript"
        ^!Set %jsFile%=^$GetScriptPath$AnyThing.js
        ^!TextToFile "^%jsFile%" ^$GetClipText(^%js%)$
        ^!Set %cscriptOut%=^$GetOutput(cscript "(^%jsFile%" file://NoLogo)

        H=ThisScript
        file://create an activeX object
        var objRec = new ActiveXObject('ADODB.Recordset');
        file://do some thing objRec object
        WScript.Echo("pass results back to Notetab")

        Once the script is debugged and working ok the loder clip can be reduced to

        ^!Set %jsFile%=^$GetScriptPath$AnyThing.js
        ^!Set %cscriptOut%=^$GetOutput(cscript "(^%jsFile%" file://NoLogo)

        and the
        script clip eliminated from the clip library as its on file in the scripts
        folder.
        Hope this helps.
        WSH is pretty cool and Notetab is a pretty good tool for using WSH.
      Your message has been successfully submitted and would be delivered to recipients shortly.