Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. Web Development
  3. JavaScript
  4. Retrieving data from an access database and show it to the user.

Retrieving data from an access database and show it to the user.

Scheduled Pinned Locked Moved JavaScript
helpdatabasequestion
4 Posts 4 Posters 19 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • G Offline
    G Offline
    gamer1127
    wrote on last edited by
    #1

    Hi, I'm having a problem retrieving a data from an access database and put it into a textbox. I tried to code it but it didn't worked. here's my code:

    function search()
    {
    try{
    var connection = new ActiveXObject("ADODB.Connection");

    var rs = new ActiveXObject("ADODB.Recordset");

    connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\IT114P\\Week2-Hibaler\\regform.mdb");

    rs.Open("select emailAddress from RegFormTable where emailAddress = '"+document.regpage.emaildelete.value+"';", connection);

    rs.MoveFirst;
    while(!rs.eof)
    {
    document.regpage.email.value = rs.fields(0);
    rs.MoveNext;

    }
    rs.close;
    conec
    }
    catch(e)
    {
    alert(e);
    }
    }

    When I use this code I always get an ObjectError message. I don't know where or what's the problem with the code. Can anyone help me?

    L S V 3 Replies Last reply
    0
    • G gamer1127

      Hi, I'm having a problem retrieving a data from an access database and put it into a textbox. I tried to code it but it didn't worked. here's my code:

      function search()
      {
      try{
      var connection = new ActiveXObject("ADODB.Connection");

      var rs = new ActiveXObject("ADODB.Recordset");

      connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\IT114P\\Week2-Hibaler\\regform.mdb");

      rs.Open("select emailAddress from RegFormTable where emailAddress = '"+document.regpage.emaildelete.value+"';", connection);

      rs.MoveFirst;
      while(!rs.eof)
      {
      document.regpage.email.value = rs.fields(0);
      rs.MoveNext;

      }
      rs.close;
      conec
      }
      catch(e)
      {
      alert(e);
      }
      }

      When I use this code I always get an ObjectError message. I don't know where or what's the problem with the code. Can anyone help me?

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Is there an "E" drive on the client? This won't work when the database is on a server. You might also take note that JavaScript can be downloaded and opened by anyone in the same way that one downloads HTML. That means that other people can see your connectionstring and open the database/make changes as they see fit.

      I are Troll :suss:

      1 Reply Last reply
      0
      • G gamer1127

        Hi, I'm having a problem retrieving a data from an access database and put it into a textbox. I tried to code it but it didn't worked. here's my code:

        function search()
        {
        try{
        var connection = new ActiveXObject("ADODB.Connection");

        var rs = new ActiveXObject("ADODB.Recordset");

        connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\IT114P\\Week2-Hibaler\\regform.mdb");

        rs.Open("select emailAddress from RegFormTable where emailAddress = '"+document.regpage.emaildelete.value+"';", connection);

        rs.MoveFirst;
        while(!rs.eof)
        {
        document.regpage.email.value = rs.fields(0);
        rs.MoveNext;

        }
        rs.close;
        conec
        }
        catch(e)
        {
        alert(e);
        }
        }

        When I use this code I always get an ObjectError message. I don't know where or what's the problem with the code. Can anyone help me?

        S Offline
        S Offline
        Sanket8989
        wrote on last edited by
        #3

        I have an code that i use to retrive data from access DB and to show into textbox. <% try { Class.forName("sun.jdbc.odbc.JdbcOdbcDriver"); con=DriverManager.getConnection("jdbc:odbc:OBS","",""); } catch(Exception e) { out.println(e);} if(con!=null) { try { Statement statement = con.createStatement(); ResultSet rs = statement.executeQuery("SELECT * from userform where srno='"+id+"'"); while(rs.next()) { n=n+1; %> <input type="text" name="fname" value="<%=rs.getString(2)%>" width="15" />

        1 Reply Last reply
        0
        • G gamer1127

          Hi, I'm having a problem retrieving a data from an access database and put it into a textbox. I tried to code it but it didn't worked. here's my code:

          function search()
          {
          try{
          var connection = new ActiveXObject("ADODB.Connection");

          var rs = new ActiveXObject("ADODB.Recordset");

          connection.Open("Provider=Microsoft.Jet.OLEDB.4.0;Data Source=E:\\IT114P\\Week2-Hibaler\\regform.mdb");

          rs.Open("select emailAddress from RegFormTable where emailAddress = '"+document.regpage.emaildelete.value+"';", connection);

          rs.MoveFirst;
          while(!rs.eof)
          {
          document.regpage.email.value = rs.fields(0);
          rs.MoveNext;

          }
          rs.close;
          conec
          }
          catch(e)
          {
          alert(e);
          }
          }

          When I use this code I always get an ObjectError message. I don't know where or what's the problem with the code. Can anyone help me?

          V Offline
          V Offline
          V 0
          wrote on last edited by
          #4

          Unless you run the web application locally on the client I would avoid using Javascript to access any database. If the application is not running locally, try ASP.Net as an alternative and run the database on the server.

          V.

          1 Reply Last reply
          0
          Reply
          • Reply as topic
          Log in to reply
          • Oldest to Newest
          • Newest to Oldest
          • Most Votes


          • Login

          • Don't have an account? Register

          • Login or register to search.
          • First post
            Last post
          0
          • Categories
          • Recent
          • Tags
          • Popular
          • World
          • Users
          • Groups