Ask a Question related to ASP Database, Design and Development.
-
Rick Roemer #1
ForwardOnly/ReadOnly ADO Problem with SQL Joins
I've recently come accross a strange problem. Everytime I attemp to
open a ForwardOnly/ReadOnly recordset with any kind of a join in it, I
can only retrieve the fields which i explicitly named in the select
statement.
Example:
sSQL = "select a.*, b.field1 from...."
oRs.Open sSQL, oConn, 0, 1
-------------------------------------
The only column i will be able to retrieve is the 'field1' column.
The rest return nothing. Although, they don't return an error either,
like it normally would if you'd put in a bad column name. If I change
either the cursor type or the lock type, it returns correctly. If I
connect to a different SQL server, it returns correctly. It also
returns correctly from query analyzer. It seems like the SQL Server
is the culprit, and not ADO, because i've tried connecting to the
problem SQL server from 2 different web servers with the same results.
Any ideas what could possibly cause this? And I realize I can get
around this by explicitly declaring my columns, changing cursor/lock
types or changing servers, but that would be difficult with that
amount of pages and data we currently have. And it also wouldn't
satisfy my intellectual curiousity.
Thanks.
Rick Roemer Guest
-
JOINs instead of AND
Where do I go to learn how to do JOINs instead of using multiple ANDs in a WHERE clause? I hear a JOIN is faster, and I am all for speed in a query. -
Query problem - multiple left joins??
I have an employee table, and an organization table. The employee table contains an ouID link which always has a match in the org.table. The... -
Collection Readonly
I have a Web service with a serializable collection class. My test app can read the collection without any problems. The problem I'm having is... -
SQL help on joins
I'm getting bogged down in figuring out how to do joins on 3 tables. The three tables are Institution, stats and signoff. Institution_ID is the... -
Help on Multiple JOINS
Paul Eaton wrote: Yes, unless it's Access, which is really picky about using parentheses to group the joins. If you're using Access, use the... -
Bob Barrows [MVP] #2
Re: ForwardOnly/ReadOnly ADO Problem with SQL Joins
Rick Roemer wrote:
The solution is simple, and is widely recommended as Good Programming> I've recently come accross a strange problem. Everytime I attemp to
> open a ForwardOnly/ReadOnly recordset with any kind of a join in it, I
> can only retrieve the fields which i explicitly named in the select
> statement.
Practice: do not use Select * in production queries. Always explicitly name
all the fields you want the query to return.
Bob Barrows
--
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.
Bob Barrows [MVP] Guest



Reply With Quote

