View Single Post
 
Old March 24th, 2004, 08:43 AM
joefawcett's Avatar
joefawcett joefawcett is offline
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