multiple query problem



Hi all
sql newbie here. The function below works as I expect on my computer,
XP IE6. i.e. I open a connection, open a recordset, fetch data, close
recordset, relplace query, open new recordset etc. Data is received
properly from both queries. BUT when I run this on another computer,
XP IE7 the BOF flag is true on the second recordset and I get "Sorry
no content" as output. I tried using a bookmark but wasn't sure what
to bookmark and don't understand the cursor style binding involved. I
also tried closing the connection and reopening it between queries but
BOF is still true on the second query. Is the problem IE version or
possibly different browser settings. Do I have to destroy the original
object and recreate? Anyone can tweak this for me or explain the
problem? TIA.
Jim
Watch out for workwrap in the sql queries. Don't forget to change
strDbPath ;>)

var adOpenDynamic = 2;
var adLockOptimistic = 3;
var strDbPath = "c:\\mypath\\mydb.mdb";
var conn_str = "Provider=Microsoft.Jet.OLEDB.4.0;Data Source=" +
strDbPath;

function getAdoDb(strAdoType) {
if (window.ActiveXObject) {
return new ActiveXObject(strAdoType);
}
else {
return new ActiveXObject(strAdoType);
}
}
var Currency = new Array();
var currTotal = new Array();
function showReports(){
try {
var strHtml ="";
strHtml += "<table cellspacing=0>";
strHtml += "<tr ><th>îëéøä</th><th>÷ðéä</th><th>éöéâ</th><th>îèáò</
th></tr>";
var conn = getAdoDb("ADODB.Connection");
conn.open(conn_str, "", "");
var rs = getAdoDb("ADODB.Recordset");
var strQuery = "SELECT CurrencyISO.CurrNameEngl AS name,
CurrencyISO.CurrencyISO AS iso, CountryISO.CountryEng AS country,
crc.bankRate, crc.saleRate, crc.buyRate, currency.view FROM crc INNER
JOIN (CountryISO INNER JOIN (CurrencyISO INNER JOIN [currency] ON
CurrencyISO.id = currency.nameID) ON CountryISO.ID =
currency.countryID) ON crc.CurrCode = currency.code WHERE
currency.view=True;";
rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);
if(!rs.bof) {
var ind = 0;
rs.MoveFirst();
while(!rs.eof) {
if (rs.fields(1).value == 'HKD') rs.MoveNext();
var per = 1;
var arr = new Array();
arr[0] = rs.fields(1).value;
if (arr[0] == 'JPY') per = 100;
arr[1] = (rs.fields(4).value * per).toFixed(4);
arr[2] = (rs.fields(5).value * per).toFixed(4);
arr[3] = (rs.fields(3).value * per).toFixed(4);
Currency[ind] = arr;
strHtml += "<tr>";
strHtml += " <td>" + arr[1] + "</td>";
strHtml += " <td>" + arr[2] + "</td>";
strHtml += " <td>" + arr[3] + "</td>";
strHtml += " <td style='text-align:right;font-weight:bold;'>" +
hebArray[ind] + "<img src='../flags/" + flagArray[ind] + "1.gif'
width=60 height=40 align='center' border='1'></td>";
strHtml += "</tr>";
ind++;
rs.MoveNext();
}
}
else {
strHtml += "<tr colspan=4><td style='text-align:center;'>àéï
îèáòåú</td></tr>";
}
strHtml += "</table>";
document.write(strHtml);
document.write('<div id="dateline">' + mydate + '</div>');
rs.close();
var strQuery = "SELECT CurrencyISO.CurrencyISO, [cashOperation].
[amount] FROM (CurrencyISO INNER JOIN [currency] ON CurrencyISO.id =
currency.nameID) INNER JOIN cashOperation ON [currency].
[code]=[cashOperation].[currencyCode]";
rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);
if(!rs.bof) {
var ind = 0;
rs.MoveFirst();
while(!rs.eof) {
var arr = new Array();
arr[0] = rs.fields(0).value;
arr[1] = rs.fields(1).value;
currTotal[ind] = arr;
ind++;
// document.write('<div>' + arr[0] + ' ' + arr[1] + '</div>');
rs.MoveNext();
}
}
else document.write('<div>Sorry no content</div>');
conn.close();
}
catch(ex) {
alert(ex.message);
}
}
.



Relevant Pages

  • Re: Reapplying successfull batch updates
    ... > A cloned TadoDataset keeps its own set of updated ... > current value after a batchupdate to the source Dataset. ... AdoRS: Recordset; ...
    (borland.public.delphi.database.ado)
  • Re: Match fields with VBA
    ... I went a little different route, using a filter on recordset. ... Dim var As Integer ... > a) SQL does not have a bang! ... > the code into your vba editor; or just save the thing as a querydef and ...
    (microsoft.public.access.modulesdaovba)
  • Recordset to 2D Array Question
    ... I'm trying to find the fastest way to get a recordset into a 2D array ... I need to handle recordset with at least 10,000 entries in ... var finalArray = new Array; ...
    (microsoft.public.scripting.jscript)
  • Re: Kein aktueller DS
    ... ob der Recordset leer ist ... ich weiß nicht, ob das auch mit Var geht, aber sonst könntest du den Umweg ... Gruß, ... Ich will eine SELECT-Abfrage ausführen. ...
    (microsoft.public.de.access)
  • Re: Passing Ado Recordsets between methods
    ... recordset between two methods in a COM+ object. ... > // RecSet is closed here! ... As soon as you are closing connection (which is implemented inside ...
    (borland.public.delphi.database.ado)