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 Mike Lewis on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

IErrorInfo.GetDesrciption with union query

Status
Not open for further replies.

zerkat

Programmer
Jul 12, 2007
103
US

I am converting an access application to .net. We are keeping the date in access - oh joy...

Any way, I have a query that I am using to populate a gridview. Since gridviews will not display a blank row if there are no records I added a union to my query in access to select a blank row from the database. This worked when we did it in SQL but in access every time I add the union into my select I receive IErrorInfo.GetDescription failed with e_fail.

PARAMETERS intEmployeeKey Short, TaskDate DateTime;
SELECT TaskTime.Pkey, TaskTime.TaskDate, TaskTime.Hours, TaskTime.Notes, Task.TaskName
FROM Employee INNER JOIN (Task INNER JOIN ([Position] INNER JOIN (EmployeePosition INNER JOIN TaskTime ON EmployeePosition.Pkey=TaskTime.EmployeePositionKey) ON Position.Pkey=EmployeePosition.PositionKey) ON Task.Pkey=TaskTime.TaskKey) ON Employee.Pkey=EmployeePosition.Employee
WHERE (((Employee.Pkey)=[intEmployeeKey]) AND ((TaskTime.TaskDate)=[TaskDate]))

UNION

SELECT '', '', '', '', ''
FROM Employee INNER JOIN (Task INNER JOIN ([Position] INNER JOIN (EmployeePosition INNER JOIN TaskTime ON EmployeePosition.Pkey=TaskTime.EmployeePositionKey) ON Position.Pkey=EmployeePosition.PositionKey) ON Task.Pkey=TaskTime.TaskKey) ON Employee.Pkey=EmployeePosition.Employee
WHERE (((Employee.Pkey)=[intEmployeeKey]) AND ((TaskTime.TaskDate)=[TaskDate]));

Can I not do this in access?
 
Seems we're here there's a few things to consider mentioning when you post in the Access forums.

Where are these parameters coming from and how are they going to be passed to the query?

You may also be adding a possibly significant (and needless) over head in your UNION, the code:
Code:
SELECT '', '', '', '', ''
FROM Employee
Will do the same thing as your current code and invloves non of the extra's that might casue slowdown.

Hope this helps

HarleyQuinn
---------------------------------
The most overlooked advantage to owning a computer is that if they foul up there's no law against wacking them around a little. - Joe Martin

Get the most out of Tek-Tips, read FAQ222-2244 before posting.

 
oh - duh - thanks. i will post on access forum and you're right there is no need to repeat the where clause in the second query
 
ok - never mind about the union query. I am going to have to figure how to add the blank row to the gridview programmatically. I found this online:


I copied and pasted it into a class in my .net project and it's telling me that Category is not defined. I did some searching and did not see that Category attribute needs to be declared before using it. Does any one know if I need to specify a namespace to use it?
 
found it - system.componentmodel
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top