SubQueries in Select statments in VB.NET

Cannot SELECT A, (SELECT B FROM C) AS B ...in VB.NET

Page 1 of 1

2 Replies - 4327 Views - Last Post: 14 August 2007 - 06:08 PM Rate Topic: -----

#1 vanhalb  Icon User is offline

  • New D.I.C Head

Reputation: 0
  • View blog
  • Posts: 1
  • Joined: 17-May 07

SubQueries in Select statments in VB.NET

Posted 17 May 2007 - 09:26 AM

I have some code that works fine in Access, but not in VB.NET. The subquery appears to be what is giving me the problem.

A section of the SQL I'm using is as follows:
 
SELECT t_object_1.Name, (SELECT t_objectproperties.Value FROM t_objectproperties WHERE (((t_objectproperties.Object_ID)=[t_object_1].[object_id]) AND ((t_objectproperties.Property)="Latency"))) AS Latency
FROM t_object AS t_object_1 INNER JOIN t_object ON t_object_1.ParentID = t_object.Object_ID
WHERE (((t_object.Object_Type)="object") AND ((t_object.Stereotype)="RdcApplication") AND ((t_object_1.Stereotype)="HFQueuingPort"));



Is there a different syntax for subqueries in VB.NET than in Access?

Is This A Good Question/Topic? 0
  • +

Replies To: SubQueries in Select statments in VB.NET

#2 ajwsurfer  Icon User is offline

  • D.I.C Regular
  • member icon

Reputation: 21
  • View blog
  • Posts: 373
  • Joined: 24-October 06

Re: SubQueries in Select statments in VB.NET

Posted 09 August 2007 - 08:54 AM

Checkout the "quotes"

That will probably break up a string

Try replacing all of the " with "".

;)
Was This Post Helpful? 0
  • +
  • -

#3 PsychoCoder  Icon User is offline

  • Google.Sucks.Init(true);
  • member icon

Reputation: 1639
  • View blog
  • Posts: 19,853
  • Joined: 26-July 07

Re: SubQueries in Select statments in VB.NET

Posted 14 August 2007 - 06:08 PM

View Postvanhalb, on 17 May, 2007 - 09:26 AM, said:

I have some code that works fine in Access, but not in VB.NET. The subquery appears to be what is giving me the problem.


Ok, what isn't working? Are you getting an error? Are you not getting the output you're wanting, if not what are you wanting?

We really need more than "it don't work" in order to offer any kind of quality help thanks :)

View Postvanhalb, on 17 May, 2007 - 09:26 AM, said:

Is there a different syntax for subqueries in VB.NET than in Access?


SQL & Access rely on the same language, Transact-SQL so the syntax would be the same for both. It has nothing to do with VB.Net (other than maybe , as already pointed out, you've got your quotes wrong)

This post has been edited by PsychoCoder: 14 August 2007 - 06:12 PM

Was This Post Helpful? 0
  • +
  • -

Page 1 of 1