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

[Clip] Re: Interesting Database Question

Expand Messages
  • 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 1 of 11 , Mar 3 3:04 AM
    • 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.