Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > ASP .Net > ASP.NET won't retrieve query results that depend on union query

Reply
Thread Tools

ASP.NET won't retrieve query results that depend on union query

 
 
Eric Nelson
Guest
Posts: n/a
 
      01-29-2009
I have a query in an MS Access DB, which selects from the results of a union
query. If I open the query in MS Access I see results. If I open the query in
VS2008 Server Explorer within an ASP.NET project, I get nothing back.

Moreover, Server Explorer shows the union query as a Stored Procedure?

What's up and how can I fix this?

Thanks
Eric
 
Reply With Quote
 
 
 
 
Alexey Smirnov
Guest
Posts: n/a
 
      01-29-2009
On Jan 29, 1:03*am, Eric Nelson <(E-Mail Removed)> wrote:
> I have a query in an MS Access DB, which selects from the results of a union
> query. If I open the query in MS Access I see results. If I open the query in
> VS2008 Server Explorer within an ASP.NET project, I get nothing back.
>
> Moreover, Server Explorer shows the union query as a Stored Procedure?
>
> What's up and how can I fix this?
>
> Thanks
> Eric


I think this is not because of union but because of OLE DB. Try to
write custom query in VS.NET using "select * from" and name of your MS
Access Query and see if this works. For example, if your query named
"Query1" and you see it under "Stored Procedures" in Server Explorer,
click "New Query" and type

SELECT * FROM Query1

Hope this helps
 
Reply With Quote
 
 
 
 
Eric Nelson
Guest
Posts: n/a
 
      02-02-2009
Hi Alexey,
Thanks for your response. I have done some experiments

I wrote a program to open an OleDbConnection to an MSAccess db, create an
OleDbCommand and execute a reader, connecting the reader to a GridView.

if the query is "select * from UnionQuery" it works.

However, if the query is "select * from NormalQueryThatUsesUnionQuery" it
returns no rows (reader.HasRows = false).

any ideas?

Thanks,
Eric



"Alexey Smirnov" wrote:

> On Jan 29, 1:03 am, Eric Nelson <(E-Mail Removed)> wrote:
> > I have a query in an MS Access DB, which selects from the results of a union
> > query. If I open the query in MS Access I see results. If I open the query in
> > VS2008 Server Explorer within an ASP.NET project, I get nothing back.
> >
> > Moreover, Server Explorer shows the union query as a Stored Procedure?
> >
> > What's up and how can I fix this?
> >
> > Thanks
> > Eric

>
> I think this is not because of union but because of OLE DB. Try to
> write custom query in VS.NET using "select * from" and name of your MS
> Access Query and see if this works. For example, if your query named
> "Query1" and you see it under "Stored Procedures" in Server Explorer,
> click "New Query" and type
>
> SELECT * FROM Query1
>
> Hope this helps
>

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-02-2009
On Feb 2, 10:19*pm, Eric Nelson <(E-Mail Removed)> wrote:
> Hi Alexey,
> Thanks for your response. I have done some experiments
>
> I wrote a program to open an OleDbConnection to an MSAccess db, create an
> OleDbCommand and execute a reader, connecting the reader to a GridView.
>
> if the query is "select * from UnionQuery" it works.
>
> However, if the query is "select * from NormalQueryThatUsesUnionQuery" it
> returns no rows (reader.HasRows = false).
>
> any ideas?
>
> Thanks,
> Eric
>
> "Alexey Smirnov" wrote:
> > On Jan 29, 1:03 am, Eric Nelson <(E-Mail Removed)> wrote:
> > > I have a query in an MS Access DB, which selects from the results of a union
> > > query. If I open the query in MS Access I see results. If I open the query in
> > > VS2008 Server Explorer within an ASP.NET project, I get nothing back.

>
> > > Moreover, Server Explorer shows the union query as a Stored Procedure?

>
> > > What's up and how can I fix this?

>
> > > Thanks
> > > Eric

>
> > I think this is not because of union but because of OLE DB. Try to
> > write custom query in VS.NET using "select * from" and name of your MS
> > Access Query and see if this works. For example, if your query named
> > "Query1" and you see it under "Stored Procedures" in Server Explorer,
> > click "New Query" and type

>
> > SELECT * FROM Query1

>
> > Hope this helps


Hi Eric,

this is exactly what I tried to do, "select * from UnionQuery" works,
but using "UNION" clause in the plain text query does nothing and
returns no result. I didn't find any information regarding this, in
the same time I see that people asking about the same problem, so
perhaps it's a bug in OLE DB, or I don't know.

Alexey
 
Reply With Quote
 
Eric Nelson
Guest
Posts: n/a
 
      02-04-2009
Hi Alexey,

Here's what I've learned:

Referring to TableAdapter.SelectCommand using the QueryBuilder to create

1. The query in QueryBuilder can be a union query itself. I finally ended up
with a union of a couple dozen joins over tables.

2. The query can reference a Union Query directly, as in "select a,b,c from
UnionQuery". The Query Builder does not show union queries in its list of
views, but you can type in the SQL command, naming the columns.

3. If the query references a query that itself uses a union query you get no
results. This must be a bug in OleDb.

Best,
Eric


"Alexey Smirnov" wrote:

> On Feb 2, 10:19 pm, Eric Nelson <(E-Mail Removed)> wrote:
> > Hi Alexey,
> > Thanks for your response. I have done some experiments
> >
> > I wrote a program to open an OleDbConnection to an MSAccess db, create an
> > OleDbCommand and execute a reader, connecting the reader to a GridView.
> >
> > if the query is "select * from UnionQuery" it works.
> >
> > However, if the query is "select * from NormalQueryThatUsesUnionQuery" it
> > returns no rows (reader.HasRows = false).
> >
> > any ideas?
> >
> > Thanks,
> > Eric
> >
> > "Alexey Smirnov" wrote:
> > > On Jan 29, 1:03 am, Eric Nelson <(E-Mail Removed)> wrote:
> > > > I have a query in an MS Access DB, which selects from the results of a union
> > > > query. If I open the query in MS Access I see results. If I open the query in
> > > > VS2008 Server Explorer within an ASP.NET project, I get nothing back.

> >
> > > > Moreover, Server Explorer shows the union query as a Stored Procedure?

> >
> > > > What's up and how can I fix this?

> >
> > > > Thanks
> > > > Eric

> >
> > > I think this is not because of union but because of OLE DB. Try to
> > > write custom query in VS.NET using "select * from" and name of your MS
> > > Access Query and see if this works. For example, if your query named
> > > "Query1" and you see it under "Stored Procedures" in Server Explorer,
> > > click "New Query" and type

> >
> > > SELECT * FROM Query1

> >
> > > Hope this helps

>
> Hi Eric,
>
> this is exactly what I tried to do, "select * from UnionQuery" works,
> but using "UNION" clause in the plain text query does nothing and
> returns no result. I didn't find any information regarding this, in
> the same time I see that people asking about the same problem, so
> perhaps it's a bug in OLE DB, or I don't know.
>
> Alexey
>

 
Reply With Quote
 
Alexey Smirnov
Guest
Posts: n/a
 
      02-04-2009
On Feb 4, 7:02*pm, Eric Nelson <(E-Mail Removed)> wrote:
> Hi Alexey,
>
> Here's what I've learned:
>
> Referring to TableAdapter.SelectCommand using the QueryBuilder to create
>
> 1. The query in QueryBuilder can be a union query itself. I finally ended up
> with a union of a couple dozen joins over tables.
>
> 2. The query can reference a Union Query directly, as in "select a,b,c from
> UnionQuery". The Query Builder does not show union queries in its list of
> views, but you can type in the SQL command, naming the columns.
>
> 3. If the query references a query that itself uses a union query you get no
> results. This must be a bug in OleDb.
>
> Best,
> Eric
>
> "Alexey Smirnov" wrote:
> > On Feb 2, 10:19 pm, Eric Nelson <(E-Mail Removed)> wrote:
> > > Hi Alexey,
> > > Thanks for your response. I have done some experiments

>
> > > I wrote a program to open an OleDbConnection to an MSAccess db, create an
> > > OleDbCommand and execute a reader, connecting the reader to a GridView.

>
> > > if the query is "select * from UnionQuery" it works.

>
> > > However, if the query is "select * from NormalQueryThatUsesUnionQuery" it
> > > returns no rows (reader.HasRows = false).

>
> > > any ideas?

>
> > > Thanks,
> > > Eric

>
> > > "Alexey Smirnov" wrote:
> > > > On Jan 29, 1:03 am, Eric Nelson <(E-Mail Removed)> wrote:
> > > > > I have a query in an MS Access DB, which selects from the results of a union
> > > > > query. If I open the query in MS Access I see results. If I open the query in
> > > > > VS2008 Server Explorer within an ASP.NET project, I get nothing back.

>
> > > > > Moreover, Server Explorer shows the union query as a Stored Procedure?

>
> > > > > What's up and how can I fix this?

>
> > > > > Thanks
> > > > > Eric

>
> > > > I think this is not because of union but because of OLE DB. Try to
> > > > write custom query in VS.NET using "select * from" and name of your MS
> > > > Access Query and see if this works. For example, if your query named
> > > > "Query1" and you see it under "Stored Procedures" in Server Explorer,
> > > > click "New Query" and type

>
> > > > SELECT * FROM Query1

>
> > > > Hope this helps

>
> > Hi Eric,

>
> > this is exactly what I tried to do, "select * from UnionQuery" works,
> > but using "UNION" clause in the plain text query does nothing and
> > returns no result. I didn't find any information regarding this, in
> > the same time I see that people asking about the same problem, so
> > perhaps it's a bug in OLE DB, or I don't know.

>
> > Alexey


Great, good to know, thanks
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
problem in running a basic code in python 3.3.0 that includes HTML file Satabdi Mukherjee Python 1 04-04-2013 07:48 PM
How do I make a table cells visibility depend on a session variable? COHENMARVIN ASP .Net 2 09-12-2005 08:09 PM
Font size depend on table height Martin Johansen HTML 7 09-22-2004 03:01 PM
union in struct without union name Peter Dunker C Programming 2 04-26-2004 07:23 PM
map XML union to C union (and vice-versa) Matt Garman XML 1 04-25-2004 12:40 AM



Advertisments