Results 1 to 8 of 8

Thread: DataBase Theory

  1. #1

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220

    DataBase Theory

    Hi,
    i know this is the vb forum but dont know of any good javascript forum so thought i would rack the brains of the good javascripters.

    I am trying to create database access to a MSDatabase the problem is that, it needs to be NON server side, you see it needs to look at the MSdatabase that is on a local server, and write to it

    i am thinkin that perhaps using vbscript and javascript

    in A EXTERNAL Javascript file

    so in a sense,
    1) ill open the database connection
    2) get the javascript to create a variable for each item i.e text box on a html page or picklist, it will create a variable for each one until there is no more,

    i.e

    var TB(1) --> (Name) 'first text box in the html page
    var TB(2) --> (Surename) ' second
    var PL(1) --> (Q1) 'first pick list in the html page

    until there is no more left, coz the amount of text box or picklist on a page will change

    3) then in the html page, put in something at the (Name) text box that tells what field in the MSDatabase the string has to go into.

    i.e Var TB(1) --> (Name,Field1)

    4) then gather up the contents of all the variables, i.e whats in the picklist, or text box

    ie VarTB(1) --> (Name,Field1,Adam)

    5) then send it to the database using a vbscript, or javascript if possible.

    Is this theory possible, i know to connect to a MSDatabase using ododb, but not sure on the other stuff, but intend to hit the books and the forum :d

  2. #2
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    www.js-x.com is a great JS forum (where I moderate). That said, there are plenty of amazing people here who should be able to help you.


    you see it needs to look at the MSdatabase that is on a local server
    I'm fairly sure that you'll need IIS installed on all your visitors PCs for this to work, you'd then have to configure their settings to how you need them (where the database is located etc). Then they'd have to download the file and run it from their localhost.

    and write to it

    i am thinkin that perhaps using vbscript and javascript
    Neither can write to files at all.

    in A EXTERNAL Javascript file

    so in a sense,
    1) ill open the database connection
    JS cannot open a DB connection, nor can it read/write to it.

    5) then send it to the database using a vbscript, or javascript if possible.
    impossible, sorry.

  3. #3

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    can you take a look a this, is code to open a database, if i can open a database, and call an alert, it cant be to much to write to a field. now if i open the connection the same way in vbscript.

    [code]
    function Query(){
    var Database = new ActiveXObject("ADODB.Connection");
    Database.Provider = "Microsoft.Jet.OLEDB.4.0";
    Database.ConnectionString = "Data Source=data.mdb";
    Database.Open;
    RS = new ActiveXObject("ADODB.Recordset");
    RS.ActiveConnection = dbc;
    RS.CursorLocation = 3;
    RS.LockType = 3;
    RS.Open ("Select * FROM TBLSTUFF");
    window.alert(RS.fieldname);
    RS.close
    Database.close
    }
    [/Highlight]

  4. #4
    Frenzied Member Acidic's Avatar
    Join Date
    Sep 2003
    Location
    UK
    Posts
    1,090
    that's serverside JS. it can't be run by the browser when the user does a certain event (eg click a button).

  5. #5

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    i have something for you gues to look at, at work we have a predicted dialer. it generates call. now there pages are view via webbrower. take a look at the attached files and you'll see its possible problem is i dont understand it to use the same file myself just modify it to do what i want.

    if you could take a look and perhaps have it running with access coz this is on sql but i dont really know enough som im learning as well from what i see :d


    tnx Adz
    Attached Files Attached Files

  6. #6

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    I have some working code to find all the elements in a html file
    and there values. ok there is on stage complete.
    no if i find how to connect to a database then using this code i can send all the types i request to a local database.

    Code:
    <!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01//EN"
      "http://www.w3.org/TR/html4/strict.dtd">
    <html lang="en-US">
    <head>
     <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
     <title>Untitled Document</title>
     <script type="text/javascript">
      function identify_Elems(){
       var f = document.forms;
        for(i=0; i<f.length; i++){
         for(j=0; j<f[i].elements.length; j++){
          alert("Type: "+f[i].elements[j].type+
                "\nName: "+f[i].elements[j].name+
                "\nValue: "+f[i].elements[j].value+
                "\nChild of form: "+ i);
        }
       }
      }
     </script>
    </head>
    <body>
     <form action="file.php" method="post" onsubmit="identify_Elems(); return false;"><div>
      Text box #1: <input type="text" name="t1" value="Text"><br>
      Text box #2: <input type="text" name="t2" value="Text"><br>
      Select box #1: <select size="1" name="s1">
       <option value="-1">Select</option>
       <option value="1">Option </option>
       <option value="2">Option </option>
      </select><br>
      <input type="submit" name="submit" value="Submit">
     </div></form>
    </body>
    </html>
    So now what will be the best way to connect to a database. It has to be possible :d

    Tnx AdZ

  7. #7
    PowerPoster techgnome's Avatar
    Join Date
    May 2002
    Posts
    34,687
    Originally posted by k0r54
    It has to be possible :d

    Tnx AdZ
    Why? Why does it *have* to be possible? Why can't it be impossible?


    Actually, there is a way..... or rather there used to be a way. It's called Remote Processing Call or RPC..... but there is a reason no one uses it, and even Microsoft (who originally helped develop the consept) doesn't recommend it (and hasn't recommended it for at least 5 years or so.) It's slow, it's clumsy and it isn't easy to set up or use.

    Before you can ask, no, I *don't* know how to do it. I haven't done an RPC setup in over 6 years and the knowledge is gone.

    You could try a Google search, but I don't know what you will find that will be of anyuse.

    TG
    * I don't respond to private (PM) requests for help. It's not conducive to the general learning of others.*
    * I also don't respond to friend requests. Save a few bits and don't bother. I'll just end up rejecting anyways.*
    * How to get EFFECTIVE help: The Hitchhiker's Guide to Getting Help at VBF - Removing eels from your hovercraft *
    * How to Use Parameters * Create Disconnected ADO Recordset Clones * Set your VB6 ActiveX Compatibility * Get rid of those pesky VB Line Numbers * I swear I saved my data, where'd it run off to??? *

  8. #8

    Thread Starter
    Addicted Member
    Join Date
    Apr 2004
    Posts
    220
    Hi, well there's hope.

    i know its possible coz i have attachted prove of it, but its behond me . It works completely client side. ill do my searchin on there

    tnx, any other help

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  



Click Here to Expand Forum to Full Width