Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations strongm on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Query returns different rows in ASP and Access

Status
Not open for further replies.

SatishPutcha

Programmer
Mar 12, 2002
256
IN
Hello Everybody,

I have a POS system developed in ASP with an Access database(the migration to MS-SQL on too).

It has around 60 tables and 300 ASP pages. Now I have seen that a query when executed in ASP at times returns different number of records as opposed to when I run the query directly in Access.

Any reasons why this could happen? My colleague who is working on the same system has also identified a similar problem.

Is this a design flaw? I am using ADODB connection and recordsets. In the two reports I saw this problem I am using disconnected recordsets like
Code:
Set rsNetStock = Server.CreateObject("ADODB.Recordset")
rsNetStock.CursorLocation = 3
rsNetStock.LockType = 3
rsNetStock.Open strStock, conn
Set rsNetStock.ActiveConnection = Nothing

Any inputs on this would be greatly helpful.

Thanks and Regards
Satish Kumar

 
I think we would need to see the SQL statement in question in order to give a better response. Short of that we would be blindly guessing.
The blind guess that pops to mind at the moment is that when you use an ORDER BY statement you need to make sure you do a MoveFirst on your recordset before looping through it, otherwise you will only loop through part of the recordset, as the cursor will not be pointing at the first record. Thats one situation where it could look like Access is getting a differant set of records than your ASP objects.

-T

barcode_1.gif
 
Tarwn

I will post the queries shortly. But I am using the MoveFirst. Even then I get different resultset in ASP.

The resultset is ASP is a subset of what I get in Access.

Thanks and Regards
Satish Kumar

 
By any chance are there 2 separate copies of the .mdb file? ... maybe a connection string is hardcoded somewhere and is pointing to the wrong copy of the db.
 
check your connection string to see if it is pointing to the correct database...

-DNG
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top