473,406 Members | 2,377 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,406 software developers and data experts.

clientside access database with javascript

Can anyone help me on this? I just need more information on all aspects of it. For example : how to add, delete, edit fields. Can i add new tables etc..

i know it is MS version of javascript so it only works in IE but thats perfect for my project and so is the clientside aspect of it as well, i know is easily hacked but I'm not worried about that since it is going to be used in an intranet setting.

here is a sample of what i am talking about everything works except the edit and i know its bulky but its just so i can see how its going to work then i will really get started on it, PLEASE help

[HTML]<html>
<head>

<script type="text/javascript">
<!--
var adOpenDynamic = 2;
var adLockOptimistic = 3;

/* Path of database.
*/
var strDbPath = "C:\\Sample.mdb";

/*
Here is the ConnectionString for Microsoft Access.
If you want to use SQL or other databases, you hav to change the connection string..
eg: SQL => var conn_str = "Provider=sqloledb; Data Source=itdev; Initial Catalog=pubs; User ID=sa;Password=yourpassword";
*/
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" + strDbPath;

function EditRecord() {
var adoConn = new ActiveXObject("ADODB.Connection");
var adoRS = new ActiveXObject("ADODB.Recordset");

adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source='\\Sample.mdb'");
adoRS.Open("Select * From SampleTable Where Group = 'Quentin'", adoConn, 1, 3);

adoRS.Edit;
adoRS.Fields("Group").value = "New Name";
adoRS.Update;

adoRS.Close();
adoConn.Close();
}


function AddRecord() {
var adoConn = new ActiveXObject("ADODB.Connection");
var adoRS = new ActiveXObject("ADODB.Recordset");

adoConn.Open("Provider=Microsoft.Jet.OLEDB.4.0;Dat a Source='/\Sample.mdb'");
adoRS.Open("Select * From SampleTable", adoConn, 1, 3);

adoRS.AddNew;
adoRS.Fields("Group").value = "Quentin";
adoRS.Update;

adoRS.Close();
adoConn.Close();
}

function getAdoDb(strAdoType){
if (window.ActiveXObject){
return new ActiveXObject(strAdoType);
}
else{
return ActiveXObject(strAdoType);
}
}

function showReports(){
try{
var strHtml ="";
strHtml += "<table cellpadding=0 cellspacing=0 border=1 width= '100%' align=center>";
strHtml += "<tr ><td align=center colspan=4><b>Sample Database Records</b></td></tr>";

//Database Connection
var conn = getAdoDb("ADODB.Connection");
conn.open(conn_str, "", "");

//Recordset
var rs = new ActiveXObject("ADODB.Recordset");
//strQuery = "SELECT * FROM SampleTable";
strQuery = "SELECT SampleTable.Date, SampleTable.Name, SampleTable.Group, SampleTable.Details FROM SampleTable";
rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);

if(!rs.bof){
rs.MoveFirst();
while(!rs.eof) {
strHtml += "<tr>";
strHtml += " <td><Font face ='tahoma'>" + rs.fields(0).value + "</font></td>";
strHtml += " <td><Font face ='tahoma'>" + rs.fields(1).value + "</font></td>";
strHtml += " <td><Font face ='tahoma'>" + rs.fields(2).value + "</font></td>";
strHtml += " <td><Font face ='tahoma'>" + rs.fields(3).value + "</font></td>";
strHtml += "</tr>";

rs.MoveNext();
}
}
else{
//No Records.
strHtml += "<tr colspan=4><td align=center><font color=red>No Records.</font></td></tr>";
}
conn.close();
strHtml += "</table>";
document.write(strHtml);
}catch(ex){
alert(ex.message);
}
}

//-->
</script>
<title>Call Log Details</title>
</head>

<!--<body onload="show_menu()">
<div id="main" />-->
<body>
<script language="JavaScript">
showReports();
</script>
<input name="Button" type="button" value="add" onClick="AddRecord()";><br>
<input name="Button" type="button" value="delete" onClick="EditRecord()";>
</body>
</html>
[/HTML]

thanks

chad
Oct 20 '07 #1
6 5556
missinglinq
3,532 Expert 2GB
Since this is a javascripts issue, I'm going to move it to the javascript/ajax forum!

Welcome to TheScripts!

Linq ;0)>
Oct 21 '07 #2
acoder
16,027 Expert Mod 8TB
Why not use an UPDATE query and make the edit via SQL?
Oct 21 '07 #3
Why not use an UPDATE query and make the edit via SQL?



My only resources are javascript and ms access all clientside.
Oct 21 '07 #4
acoder
16,027 Expert Mod 8TB
My only resources are javascript and ms access all clientside.
I meant instead of a SELECT query, use an UPDATE query, e.g.
Expand|Select|Wrap|Line Numbers
  1. UPDATE SampleTable set Group = "New Name" where Group = "Quentin"
Oct 22 '07 #5
Hi. I'm interested in learning more about this technique but I don't know where to start.

I'm trying to prototype something like an asp.net gridview/details view kind of thing that has to use client side code and an access mdb (because it's completely offline - no IIS, .net etc).

Does anyone have any urls? I'm lost in google land..... Thanks
Dec 12 '07 #6
acoder
16,027 Expert Mod 8TB
Welcome to TSDN!
Hi. I'm interested in learning more about this technique but I don't know where to start.

I'm trying to prototype something like an asp.net gridview/details view kind of thing that has to use client side code and an access mdb (because it's completely offline - no IIS, .net etc).

Does anyone have any urls? I'm lost in google land..... Thanks
What code do you have so far?
Dec 12 '07 #7

Sign in to post your reply or Sign up for a free account.

Similar topics

7
by: PhilM | last post by:
New to javascript. Is it possible to use javascript to scan a directory client side. If so, could someone point me in the general direction of information on how to. I do not know what keywords I...
4
by: Zeebra3 | last post by:
Here goes: I have a web form with several asp:dropdownlists, with which, when selection is changed I want to fire an event defined in some clientside js. The content of the clientside code is...
0
by: anonymous | last post by:
Thanks Michelle, How could I achieve the second one.I do not like Flashing windows in response to selection of an item. I agree the data transfer is very little but the same data transferred for...
1
by: IkBenHet | last post by:
Hello, Currently I am using a large input form on a website that is based on ASP and JavaScript. Depending on the values that are filled in by the user the forms does a refresh and makes...
3
by: RFS666 | last post by:
Hello together, I tried to find out about populating an asp.net server control (a dropdownlist) from the clientside jscript, but I didn't find a solution up to now. I cannot use a html...
1
by: dany | last post by:
Hello I want to syndicate some content to other users. (no RSS) Anybody should be able to publish some information from my server/database by placing some javascript like: <script...
16
by: susiedba | last post by:
hey I used to be able to take VB6 code and paste it into a HTML page and it would run on the clientside does anyone know if this is possible in VB 2005? Thanks -Susie
2
by: John Kotuby | last post by:
Hi all, In ASP.NET 2.0 and VB.NET, I am trying to get the OnSelectedIndexChanged event to fire a Javascript function. There is no OnClientClick event for that control. When I try something...
2
by: akineko | last post by:
Hello everyone, I have used Python SimpleXMLRPCServer to expose several methods to be used. My Python script creates a free-standing server and not a CGI script. I have tested its exposed...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.