Re: multiple query problem
- From: "Bob Barrows [MVP]" <reb01501@xxxxxxxxxxxxxxx>
- Date: Wed, 9 Apr 2008 10:49:46 -0400
J.J.Cale wrote:
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
Well, being at work, I'm not going to try and plow through all this. But
I doubt this is an ADO problem. Typically you would get a "cannot
perform action while object is open" error rather than BOF if there was
a problem requiring you to destroy and recreate either your connection
or recordset objects. No, I think that if you successfully open a
recordset, and BOF is true, then the query did not return any records
and you need to investigate why. The first step is to look at the sql
statement (not the code that is supposed to result in the sql statement:
the statement that results from the code. This looks like client-side
script in a web page, so either write the contents of strQuery to a div
or alert it so you can verify that it contains what you think it should
contain.
Incidently, I don't think it makes any difference, but testing for EOF
rather than BOF immediately after opening the recordset is more
typically done. Keep in mind that you have to test for both if any
navigation is performed in the recordset (movenext, movefirst, etc)
And please: try and strip out the parts of your code that are not
necessary to illustrate your problem. for example, we really do not need
to see the code that results from a successful retrieval of data, do we?
Given that we do not have your database, it's not likely that we are
going to attempt to run your code, no is it? :-) Replace all that stuff
with a comment that says 'processing retrieved data' or something like
that. it will make us more likely to actually look at your code.
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;
<snip>
rs.open(strQuery, conn, adOpenDynamic, adLockOptimistic);
--
Microsoft MVP -- ASP/ASP.NET
Please reply to the newsgroup. The email account listed in my From
header is my spam trap, so I don't check it very often. You will get a
quicker response by posting to the newsgroup.
.
- References:
- multiple query problem
- From: J.J.Cale
- multiple query problem
- Prev by Date: multiple query problem
- Next by Date: Help with SQL String from Access Query
- Previous by thread: multiple query problem
- Next by thread: Help with SQL String from Access Query
- Index(es):
Relevant Pages
|
|