Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
  #1 (permalink)  
Old March 23rd, 2004, 09:21 AM
Registered User
 
Join Date: Mar 2004
Location: , , .
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Default Access Database from Javascript with rds

Hi I want to access an MS Access from javascript but it doesn't work. The resulting recordset includes no records.
Code:
<object id="rdsdc" classid="clsid:bd96c556-65a3-11d0-983a-00c04fc29e33">
<PARAM NAME="SERVER" VALUE="http://localhost">
<param name="Connect" value="Provider=Microsoft.Jet.OLEDB.4.0;
Data Source=D:\Webserver\wwwroot\adb1.mdb;">
<param name="sql" value="select * from Artikel">
</object>
Thanks for ur help

---Gerson Kramer
www.aldirezepte.de
  #2 (permalink)  
Old March 24th, 2004, 08:43 AM
joefawcett's Avatar
Wrox Author
Points: 9,763, Level: 42
Points: 9,763, Level: 42 Points: 9,763, Level: 42 Points: 9,763, Level: 42
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jun 2003
Location: Exeter, , United Kingdom.
Posts: 3,074
Thanks: 1
Thanked 38 Times in 37 Posts
Default

It can be very difficult to get this technology to work because of security and the error messages are hopeless.
I normally create the objects rather than use an embedded control, here's my test page.
Code:
<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<html>
<head>
<title>RDS Test</title>
<meta name="GENERATOR" content="Microsoft Visual Studio .NET 7.1">
<meta name="vs_targetSchema" content="http://schemas.microsoft.com/intellisense/ie5">
<script>


function getRsByRds(ServerName, ConnString, Sql)
{
  var sServer = "http://" + ServerName; 
  var oDS = new ActiveXObject("RDS.DataSpace");
  var oDF = oDS.CreateObject("RDSServer.DataFactory", sServer);
  oRs = oDF.Query(ConnString, Sql);
  return oRs;
}

function showDetails(Server, DbPath, Sql)
{
  var sConnString = "Provider=Microsoft.Jet.OLEDB.4.0; Data Source=" + DbPath;
  var sSql = Sql;
  var oRs = getRsByRds(Server, sConnString, sSql);
  if (oRs.BOF && oRs.EOF)
  {
    showResult("No records found");    
  }
  else
  {
    showResult(oRs.getString());
  }
  oRs.close();
}
function showResult(Text)
{
  document.getElementById("txtResults").value = Text;
}

</script>
</head>
<body>
Server:<input type="text" id="txtServer" size="75"><br>
DB path:<input type="text" id="txtDbPath" size="75"><br>
SQL:<input type="text" size="80" id="txtSql"><br>
<input type="button" value="Show Details" onclick="showDetails(txtServer.value, txtDbPath.value, txtSql.value);"><br>
<textarea id="txtResults" cols="80" rows="40"></textarea>
</body>
</html>
--

Joe
  #3 (permalink)  
Old February 3rd, 2005, 07:19 PM
Registered User
 
Join Date: Feb 2005
Location: Rio de Janeiro, Rio de Janeiro, Brazil.
Posts: 1
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to uideas
Default

Hi, I´m trying to access a microsoft access database with a javascript routine, the same way as you mantioned in the example above, but nothing is working here. I have someexperience with ASP, but very few with Javascript, i´ve tried to use your code but it freezes my browser. Please help me to find the "yellow brick road" :-)

Thanks,
Luiz Eduardo


Similar Threads
Thread Thread Starter Forum Replies Last Post
Javascript Access Database Query panuvin Javascript How-To 28 May 9th, 2008 01:53 PM
access sql database using javascript vivek_inos Javascript How-To 2 October 12th, 2006 01:29 PM
Problem accessing Access Database using JavaScript kumar_siva Javascript 0 February 7th, 2006 07:09 AM
RDS Single Record and Table Binding with Access qwerty Classic ASP Databases 0 July 15th, 2003 02:20 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.