Talk About Network

Google


Register and Login
Nick
Password
Register create new account Sign up is FREE and you can post replies, new topics, bookmark posts and more!
Recover lost password


Software > ADO Data > multiple query ...
Latest [ Topics | Posts ] Archive Post A New Topic Post a Reply
<< Topic < Post Post 1 of 2 Topic 4203 of 4320
Post > Topic >>

multiple query problem

by "J.J.Cale" <jimbo@[EMAIL PROTECTED] > Apr 9, 2008 at 07:21 AM

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 =3D 2;
var adLockOptimistic =3D 3;
var strDbPath =3D "c:\\mypath\\mydb.mdb";
var conn_str =3D "Provider=3DMicrosoft.Jet.OLEDB.4.0;Data Source=3D" +
strDbPath;

function getAdoDb(strAdoType) {
	if (window.ActiveXObject) {
		return new ActiveXObject(strAdoType);
	}
	else {
		return new ActiveXObject(strAdoType);
	}
}
var Currency =3D new Array();
var currTotal =3D new Array();
function showRe****ts(){
	try {
		var strHtml =3D"";
		strHtml +=3D "<table cellspacing=3D0>";
		strHtml +=3D "<tr
><th>=EE=EB=E9=F8=E4</th><th>=F7=F0=E9=E4</th><th>=E9=F6=
=E9=E2</th><th>=EE=E8=E1=F2</
th></tr>";
		var conn =3D getAdoDb("ADODB.Connection");
		conn.open(conn_str, "", "");
		var rs =3D getAdoDb("ADODB.Recordset");
		var strQuery =3D  "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 =3D currency.nameID) ON CountryISO.ID =3D
currency.countryID) ON crc.CurrCode =3D currency.code WHERE
currency.view=3DTrue;";
		rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);
		if(!rs.bof) {
			var ind =3D 0;
			rs.MoveFirst();
			while(!rs.eof) {
				if (rs.fields(1).value =3D=3D 'HKD') rs.MoveNext();
				var per =3D 1;
				var arr =3D new Array();
				arr[0] =3D rs.fields(1).value;
				if (arr[0] =3D=3D 'JPY') per =3D 100;
				arr[1] =3D (rs.fields(4).value * per).toFixed(4);
				arr[2] =3D (rs.fields(5).value * per).toFixed(4);
				arr[3] =3D (rs.fields(3).value * per).toFixed(4);
				Currency[ind] =3D arr;
				strHtml +=3D "<tr>";
				strHtml +=3D " <td>" + arr[1] + "</td>";
				strHtml +=3D " <td>" + arr[2] + "</td>";
				strHtml +=3D " <td>" + arr[3] + "</td>";
				strHtml +=3D " <td style=3D'text-align:right;font-weight:bold;'>" +
hebArray[ind] + "<img src=3D'../flags/" + flagArray[ind] + "1.gif'
width=3D60 height=3D40 align=3D'center' border=3D'1'></td>";
				strHtml +=3D "</tr>";
				ind++;
				rs.MoveNext();
			}
		}
		else {
			strHtml +=3D "<tr colspan=3D4><td
style=3D'text-align:center;'>=E0=E9=EF
=EE=E8=E1=F2=E5=FA</td></tr>";
		}
		strHtml +=3D "</table>";
		do***ent.write(strHtml);
		do***ent.write('<div id=3D"dateline">' + mydate + '</div>');
		rs.close();
		var strQuery =3D  "SELECT CurrencyISO.CurrencyISO, [cashOperation].
[amount] FROM (CurrencyISO INNER JOIN [currency] ON CurrencyISO.id =3D
currency.nameID) INNER JOIN cashOperation ON [currency].
[code]=3D[cashOperation].[currencyCode]";
		rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);
		if(!rs.bof) {
			var ind =3D 0;
			rs.MoveFirst();
			while(!rs.eof) {
				var arr =3D new Array();
				arr[0] =3D rs.fields(0).value;
				arr[1] =3D rs.fields(1).value;
				currTotal[ind] =3D arr;
				ind++;
//				do***ent.write('<div>' + arr[0] + ' ' + arr[1] + '</div>');
				rs.MoveNext();
			}
		}
		else do***ent.write('<div>Sorry no content</div>');
		conn.close();
	}
	catch(ex) {
		alert(ex.message);
    }
}
 




 2 Posts in Topic:
multiple query problem
"J.J.Cale" <  2008-04-09 07:21:31 
Re: multiple query problem
"Bob Barrows [MVP]&q  2008-04-09 10:49:46 

Post A Reply:
  Go here to Signup

AddThis Feed Button


About - Advertising - Contact - Frequently Asked Questions - Privacy Policy - Terms of Use - Signup

Contact
tan12V112 Sat Nov 22 15:43:31 CST 2008.