views:

1780

answers:

8

I have to display marks of my students through my site. the database is created using msaccess. how can I display the marks of each student in a table, as the enter the regno.

+3  A: 

JavaScript can't directly access the database. You'll need to have some server-side component that takes requests (probably via HTTP), parses them and returns the requested data.

Then the JavaScript could access that component to fetch the data (hm ... smells like AJAX).

Joachim Sauer
Did you know that you can write ASP pages in Javascript rather than VB script?
Martin Brown
No, I didn't. I'm not an ASP person, I'm more on the Java side of things
Joachim Sauer
+4  A: 

Why do you want to use Javascript? It runs in the browser of the site's visitors, and even if there were a way to have it directly access a database (which there isn't), it would be a horrible security risk, since it would have to contain the DB password, so that each visitor of the site could get full access to the DB.

What you need is something that runs on the server and accesses the DB to deliver different pages to the visitor depending on data entered in an HTML form. Typical languages used for this are PHP, Perl, Ruby or ASP.

Also note that MS Access is a very poor choice as a DB backend to a web app since it does not support concurrent access from different users.

All in all it looks like you need more direct help than this site can provide; try finding a web app specialist in your area.

Michael Borgwardt
Did you know that you can write ASP pages in Javascript rather than VB script?
Martin Brown
Access is fine for any read-only web application. Concurrency is not an issue in this case.
Diodeus
I did not know that specifically ASP pages can be written in JS, but I'm aware that it does not only run in browsers; still, it is the most common case and I think it's very likely that shameer meant client-side JS. And my understanding is that Access limits concurrent users even for readonly access
Michael Borgwardt
Access is fine, as long as you don't start sharing the file on a network at the same time it's on the web site. I've used it with some fairly busy sites (not my choice) and it performs well without problems. Don't put the DB in the web root or it could be downloaded in one go.
Diodeus
+2  A: 

I havent used M$ Access for a very long time, but I think they have some pretty good ways to export data to an HTML format. That will be static HTML code, but that could be enough for what you want to do. Definitely easier than writing a DB backend ...

Guillaume
A: 

JavaScript (or any client-side language) has no ability to access something which is still located on the server. You're best option is to use an AJAX implementation and have a series of web services which you can query from your JavaScript and return the results in a usable format (most likely JSON).

Slace
A: 

You are think from a client side, whereas you should be thinking on the server side.

You need a script on the server side that will query Access, and create the HTML for it, depending upon the value of a registration number supplied in a form.

The scripting language is up to you. Given that you are using Access, I imagine one of the Microsoft family of languages would be best, and that your institution will have a web server already (presumably IIS) to host your website.

First things first:

  • What server software is your institution running? This determines the best programming language to use.
  • What budget do you have. If it is near zero, then you are looking at free IDEs. It might be better to develop in Eclipse and deploy on Tomcat, regardless of the server OS.
  • What languages do you know?
  • Get a book on programming websites using your technology of choice. For example with Java I'd suggest using Struts and Tiles for a simple website like this.
  • You might want to migrate the data from Access to a database backend - MSSQL if your institution already has a license, or MySQL or PostgreSQL if you have a budget of zero.

From your question it sounds like this is all new to you. This is a small project however, so an ideal start to learning how to write interactive websites.

JeeBee
A: 

I think this is a dupe for: http://stackoverflow.com/questions/298057/are-there-javascript-bindings-for-mysql

Tomalak
I agree ;-) I was looking for this reference...
PhiLho
A: 

If you're looking for client-side database access, then what everyone else said.

If you're just looking for a way to access a database (NOT in a browser), and Javascript is the language you're most comfortable with, try JSDB. (It's a Javascript shell that has bindings for databases via ODBC, SQLite, and flat files) I've used it a lot and it's my preferred scripting shell.

Jason S
A: 

Here is a simple ASP (vbscript) script that will dump your data into a table. You can edit the path and query to suit your situation. As mentioned by others, it does not provide decent security.

Call it with FILENAME.asp?regno=xxxxx

<%
Set Conn = Server.CreateObject("ADODB.Connection")
Conn.Open "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=c:/YourDatabase.mdb"
SQL = "Select * from TABLENAME where regno=" & request("regno")
set RS= Conn.execute(SQL)
%>
<table>
    <tr>
    <% for x=0 to rs.fields.count-1 %>
     <th><%=RS.fields(x).value%></th>
    <% next %>
    </tr>
    <% do until RS.eof %>
     <tr>
      <% for x=0 to rs.fields.count-1 %>
       <td><%=RS.fields(x).value%></td>
      <% next %>
    </tr>
    <% rs.movenext %>
    <% loop %>
</table>
<%
RS.close()
set Conn=nothing
%>
Diodeus