Ask a Question related to ASP Database, Design and Development.
-
Inner Join problem
Hello
I have windows 2000 professional, MS Access 2002 installed
on my system. When I execute a simple query from an asp
page it works well but when I execute a query with inner
join, it displays:
Error Type:
(0x80004005)
Unspecified error
Can some one help to resolve this problem.
Regards
Guest
-
Join problem
Hello I have 2 tables Players Player ....... A B C -
SQL JOIN Problem !!! Could you help me please ???
Hi everybody, I've got a problem with my SQL JOIN on my database stored on UNIX machine by Oléane !!!! (my SQL query is stored in php page) ... -
Problem with join and unicode
I have a problem with the join command inserting and extra \n on the end of every line. I don't seen to be able to get rid of them. ... -
left join problem
if you just need something unique in the result set, 1. combination (NJIDATA.GLPMSTR.ID, NJIDATA.GLPMTRN.ID) is unique 2. you could also use... -
Join problem in a View
I have 2 tables: FILES and ACTIONS I would like all the Files to get listed with all their Actions when the actions are on a certain date. So... -
Bob Barrows #2
Re: Inner Join problem
[email]sajid622@hotmail.com[/email] wrote:
Not until you give us more info.> Hello
>
> I have windows 2000 professional, MS Access 2002 installed
> on my system. When I execute a simple query from an asp
> page it works well but when I execute a query with inner
> join, it displays:
> Error Type:
> (0x80004005)
> Unspecified error
>
> Can some one help to resolve this problem.
>
Are you executing a saved query (recommended) or using dynamic sql to build
the query?
If you are using dynamic sql, the best troubleshooting tool you can use is
response.write. Use it like this:
dim strSQL
strSQL = " ... table1 inner join table 2 ..."
response.write strSQL
response.end
Run the page and look at the statement written to the browser window. Is it
a statement that can be run as-is in Access? To find out:
Open your database in Access.
Go to the Queries tab and create a new query in Design View.
Close the Choose Table dialog without selecting a table.
Switch to SQL View using the toolbar button, or the right-click menu, or the
View menu
Copy and paste the statement from the browser window into the SQL View
window
Try to run it
If that does not show you what your problem was, then show us the sql
statement that you pasted into SQL View and show us the code used to build
it.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
Sajid #3
Re: Inner Join problem
dynamic sql to build>Are you executing a saved query (recommended) or usingThank you for your help. Here are the details.>the query?
When I use dynamic sql it doesnt work. But when I save the
same query, and execute from asp it works fine.
This problem occurs with a query having more than one
inner joins. My query looks like this:
SELECT Stock.idStock, Stock.quantity, Stock.weight,
Stock.TradePrice, Stock.RetailPrice, ProductSizes.size,
ProductColors.Color, Stock.idProduct, ProductSizes.idSize,
ProductColors.idColor
FROM Stock, ProductColors, ProductSizes
WHERE (((ProductSizes.idSize)=[Stock].[idSize]) AND
((ProductColors.idColor)=[Stock].[idColor]))
Regards
Sajid
Sajid Guest
-
Ken Schaefer #4
Re: Inner Join problem
Can you run that query inside Access? Does it work there?
Cheers
Ken
"Sajid" <sajid622@hotmail.com> wrote in message
news:05e601c3bfa7$b2bbed90$a501280a@phx.gbl...
:
: >Are you executing a saved query (recommended) or using
: dynamic sql to build
: >the query?
:
: Thank you for your help. Here are the details.
: When I use dynamic sql it doesnt work. But when I save the
: same query, and execute from asp it works fine.
:
: This problem occurs with a query having more than one
: inner joins. My query looks like this:
:
: SELECT Stock.idStock, Stock.quantity, Stock.weight,
: Stock.TradePrice, Stock.RetailPrice, ProductSizes.size,
: ProductColors.Color, Stock.idProduct, ProductSizes.idSize,
: ProductColors.idColor
: FROM Stock, ProductColors, ProductSizes
: WHERE (((ProductSizes.idSize)=[Stock].[idSize]) AND
: ((ProductColors.idColor)=[Stock].[idColor]))
:
: Regards
:
: Sajid
Ken Schaefer Guest
-
Bob Barrows #5
Re: Inner Join problem
Sajid wrote:
Still not enough information. What does "doesnt work" mean? error messages?>>> Are you executing a saved query (recommended) or using dynamic sql
>> to build the query?
> Thank you for your help. Here are the details.
> When I use dynamic sql it doesnt work.
incorrect results? If you're getting an error message, show it to us.
So why not continue to execute it as a saved query? That is the most> But when I save the
> same query, and execute from asp it works fine.
efficient way to execute a query. If you need to use dynamic search
criteria, use parameters. If you do a Google search on this newsgroup for
"saved parameter query", you will see several examples of using them.
Usually, if a query can be run successfully by your database's query tool,>
> This problem occurs with a query having more than one
> inner joins. My query looks like this:
>
> SELECT Stock.idStock, Stock.quantity, Stock.weight,
> Stock.TradePrice, Stock.RetailPrice, ProductSizes.size,
> ProductColors.Color, Stock.idProduct, ProductSizes.idSize,
> ProductColors.idColor
> FROM Stock, ProductColors, ProductSizes
> WHERE (((ProductSizes.idSize)=[Stock].[idSize]) AND
> ((ProductColors.idColor)=[Stock].[idColor]))
>
but not via ADO, this indicates the presence of at least one reserved
keyword in the query. I checked here:
[url]http://www.aspfaq.com/show.asp?id=2080[/url], and sure enough, one of your fields
is named "Size", which appears on the list of reserved keywords which should
be avoided when naming fields and tables in your database.
My recommendation is to change the name of that field to a non-reserved
word. If you can't do that, then you will need to remember to wrap it with
brackets whenever using it in a query executed via ADO: [size]. The query
parser will ignore strings placed inside brackets.
HTH,
Bob Barrows
--
Microsoft MVP - ASP/ASP.NET
Please reply to the newsgroup. This email account is my spam trap so I
don't check it very often. If you must reply off-line, then remove the
"NO SPAM"
Bob Barrows Guest
-
McKirahan #6
Re: Inner Join problem
"Sajid" <sajid622@hotmail.com> wrote in message
news:05e601c3bfa7$b2bbed90$a501280a@phx.gbl...>> dynamic sql to build> >Are you executing a saved query (recommended) or using>> >the query?
> Thank you for your help. Here are the details.
> When I use dynamic sql it doesnt work. But when I save the
> same query, and execute from asp it works fine.
>
> This problem occurs with a query having more than one
> inner joins. My query looks like this:
>
> SELECT Stock.idStock, Stock.quantity, Stock.weight,
> Stock.TradePrice, Stock.RetailPrice, ProductSizes.size,
> ProductColors.Color, Stock.idProduct, ProductSizes.idSize,
> ProductColors.idColor
> FROM Stock, ProductColors, ProductSizes
> WHERE (((ProductSizes.idSize)=[Stock].[idSize]) AND
> ((ProductColors.idColor)=[Stock].[idColor]))
>
> Regards
>
> Sajid
I may be wrong (it happens often) but wouldn't an INNER JOIN look like:
SELECT
Stock.idStock,
Stock.quantity,
Stock.weight,
Stock.TradePrice,
Stock.RetailPrice,
ProductSizes.size,
ProductColors.Color,
Stock.idProduct,
ProductSizes.idSize,
ProductColors.idColor
FROM (Stock
INNER JOIN ProductColors ON Stock.idSize = ProductSizes.idSize)
INNER JOIN ProductSizes ON Stock.idColor = ProductColors.idColor
)
Watch for word-wrap. Also, enclose reserved words in brackets.
McKirahan Guest
-
McKirahan #7
Re: Inner Join problem
Please ignore the final ")" in my previous post.
"McKirahan" <News@McKirahan.com> wrote in message
news:Cu1Cb.21699$8y1.102215@attbi_s52...> "Sajid" <sajid622@hotmail.com> wrote in message
> news:05e601c3bfa7$b2bbed90$a501280a@phx.gbl...>> >> > dynamic sql to build> > >Are you executing a saved query (recommended) or using> >> > >the query?
> > Thank you for your help. Here are the details.
> > When I use dynamic sql it doesnt work. But when I save the
> > same query, and execute from asp it works fine.
> >
> > This problem occurs with a query having more than one
> > inner joins. My query looks like this:
> >
> > SELECT Stock.idStock, Stock.quantity, Stock.weight,
> > Stock.TradePrice, Stock.RetailPrice, ProductSizes.size,
> > ProductColors.Color, Stock.idProduct, ProductSizes.idSize,
> > ProductColors.idColor
> > FROM Stock, ProductColors, ProductSizes
> > WHERE (((ProductSizes.idSize)=[Stock].[idSize]) AND
> > ((ProductColors.idColor)=[Stock].[idColor]))
> >
> > Regards
> >
> > Sajid
>
> I may be wrong (it happens often) but wouldn't an INNER JOIN look like:
>
> SELECT
> Stock.idStock,
> Stock.quantity,
> Stock.weight,
> Stock.TradePrice,
> Stock.RetailPrice,
> ProductSizes.size,
> ProductColors.Color,
> Stock.idProduct,
> ProductSizes.idSize,
> ProductColors.idColor
> FROM (Stock
> INNER JOIN ProductColors ON Stock.idSize = ProductSizes.idSize)
> INNER JOIN ProductSizes ON Stock.idColor = ProductColors.idColor
> )
>
> Watch for word-wrap. Also, enclose reserved words in brackets.
>
>
McKirahan Guest
-
Bob Barrows #8
Re: Inner Join problem
McKirahan wrote:
This is the (newer) ANSI-style join syntax. The older style syntax (putting> "Sajid" <sajid622@hotmail.com> wrote in message
> news:05e601c3bfa7$b2bbed90$a501280a@phx.gbl...> I may be wrong (it happens often) but wouldn't an INNER JOIN look>>
> like:> INNER JOIN ProductColors ON Stock.idSize = ProductSizes.idSize)>> FROM (Stock
> INNER JOIN ProductSizes ON Stock.idColor = ProductColors.idColor
> )
>
the join conditions in the WHERE clause) still works but is not recommended.
And yes, it was called an "inner join" in the older syntax.
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 Guest



Reply With Quote

