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

[Clip] Re: Interesting Database Question

Expand Messages
  • Clint Tredway
    Wayne you are correct. I use both Access and MS SQL 7. I am trying to create some really complex clips to help in my web application development. If someone
    Message 1 of 11 , Mar 1, 2000
      Wayne you are correct. I use both Access and MS SQL 7. I am trying to create
      some really complex clips to help in my web application development. If
      someone could help write this clip I would be very grateful

      Thanks

      Clint

      -----Original Message-----
      From: Wayne VanWeerthuizen [mailto:wayne@...]
      Sent: Wednesday, March 01, 2000 2:41 PM
      To: ntb-clips@egroups.com
      Subject: [Clip] Re: Interesting Database Question


      Jody <KJB1611@...> wrote:
      >Hi Clint,
      >
      > > Does anyone know if a clip can be written to query a database
      > > and return the tables and the be able to read the column's out
      > > of a specified table?
      >
      >You might try my NoteBlock on my Libraries page. When you say
      >"table" I don't know if you mean like an HTML table, but I have

      No. Clint was clearly asking about databases. A table
      (a 2 dimensional array of data) is a fundamental concept
      in relational databases.

      The answer depends on the database software in question.
      NoteTab does not have anyway of directly interfacing with
      databases; so I believe the database would have to allow
      queries to be given from the command line (e.g. DOS prompt).

      If I knew what database Clint was using (MS Access maybe?)
      someone could possibly write a command line utility for it,
      if it doesn't have one already. I really need to learn
      more about Access. ;-) I am used to using SQL databases
      from the Linux command line, but have never used Access.




      --
      Wayne M. VanWeerthuizen
      Homepage: http://landru.myhome.net/wayne

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

      -- Create a poll/survey for your group!
      -- http://www.egroups.com/vote?listname=ntb-clips&m=1
    • Wayne VanWeerthuizen
      ... I posted a response earlier, but probably was thinking more complicated than you really need. If this is a job you only need to do occasionally, and don t
      Message 2 of 11 , Mar 1, 2000
        Jody <KJB1611@...> wrote:
        >Hi Clint,
        >
        > > Does anyone know if a clip can be written to query a database
        > > and return the tables and the be able to read the column's out
        > > of a specified table?
        >

        I posted a response earlier, but probably was thinking more
        complicated than you really need.

        If this is a job you only need to do occasionally, and don't
        have to worry about the database being updated during the
        process, you only need to export the table as a tab delimited
        file. Then my clipbook called NoteAwk has some good tools for
        extracting any fields you need from the file.

        (http://landru.myhome.net/wayne/notetab.html)

        If you need to be able to give the database more advanced queries,
        or work with it "live" (e.g. while it is being modified by other
        programs), then you'll need to find a way to access it via a
        command line.

        If you have specific questions about the process, send me a
        private email. I'll help if I know the answer.


        --
        Wayne M. VanWeerthuizen
        Homepage: http://landru.myhome.net/wayne
      • Jody
        Hi Clint, ... Try exporting the database as a text delimited file. I am not familiar enough with the apps you mention so that is all I can offer. then you
        Message 3 of 11 , Mar 1, 2000
          Hi Clint,

          > Wayne you are correct. I use both Access and MS SQL 7. I am
          > trying to create some really complex clips to help in my web
          > application development.

          Try exporting the database as a text delimited file. I am not
          familiar enough with the apps you mention so that is all I can
          offer. then you can use my NoteBlock to extract, reorder, edit
          etc. and then import it back into the other apps. That is, if
          they work that way.

          Happy Clip'n!
          Jody

          http://www.sureword.com/notetab

          Subscribe, UnSubscribe, Options
          mailto:Ntb-Clips-Subscribe@...
          mailto:Ntb-Clips-UnSubscribe@...
          http://www.egroups.com/list/ntb-clips
        • Wayne VanWeerthuizen
          ... I just had another thought about this. I am still not certain what exactly Clint wants to accomplish. If it is fairly simple, then I repeat that using a
          Message 4 of 11 , Mar 1, 2000
            Clint Tredway <CTredway@...> wrote:
            >Wayne you are correct. I use both Access and MS SQL 7. I am trying
            >to create some really complex clips to help in my web application
            >development. If someone could help write this clip I would be very
            >grateful.

            I just had another thought about this.

            I am still not certain what exactly Clint wants to accomplish.
            If it is fairly simple, then I repeat that using a delimited
            text file is very likely the _BEST_ way to go.



            BUT if the task really is complicated, or if the database is
            fairly large, it could be easier and more efficient to write
            a Perl script. In fact, it is very very very likely that a
            module for Activeperl exists that will allow direct access to
            a live MS SQL 7 database. And for large amounts of data,
            Perl is significantly faster than NoteTab's clip language.


            --
            Wayne M. VanWeerthuizen
            Homepage: http://landru.myhome.net/wayne
          • Clint Tredway
            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
            Message 5 of 11 , Mar 1, 2000
              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.
            • Wayne VanWeerthuizen
              ... I recommend you start by doing as much as you can with Visual Basic. After that, we will find a way to launch your visual basic program from NoteTab and
              Message 6 of 11 , Mar 1, 2000
                Clint Tredway <CTredway@...> wrote:
                >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.

                I recommend you start by doing as much as you can with Visual Basic.

                After that, we will find a way to launch your visual basic program
                from NoteTab and capture its output to the current document, all in
                one step via a clip.


                --
                Wayne M. VanWeerthuizen
                Homepage: http://landru.myhome.net/wayne
              • 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 7 of 11 , Mar 1, 2000
                  -----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 8 of 11 , Mar 3, 2000
                    > 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.