[Last Call] Learn how to a build a cloud-first strategyRegister Now

x
?
Solved

SELECT Question

Posted on 2005-05-09
7
Medium Priority
?
331 Views
Last Modified: 2010-04-23
dr = Dssubs.tblsubs.Select("SELECT * FROM tblsubs WHERE group = " & group)

this line is erroring telling me that i am missing an operand or something, any ideas? dr is a datarow
0
Comment
Question by:addicktz
7 Comments
 
LVL 33

Expert Comment

by:sajuks
ID: 13965892
group is a reserved word
try placing that within square brackets
SELECT * FROM tblsubs WHERE [group] = " & group
0
 
LVL 8

Expert Comment

by:doobdave
ID: 13966488
Hi addicktz,

what is the error msg you're getting?
0
 
LVL 70

Expert Comment

by:Éric Moreau
ID: 13966693
"group" is a reserved keyword (for GROUP BY). The easiest way is to change its name. Otherwise, you can try this:

dr = Dssubs.tblsubs.Select("SELECT * FROM tblsubs WHERE [group] = " & group)

PS: I hope this field is of numeric datatype (or you need to surround the value with single quotes)!
0
What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

 
LVL 6

Expert Comment

by:carmodyk
ID: 13969482
Try this

dr = Dssubs.tblsubs.Select("SELECT * FROM tblsubs WHERE group = '" & group & "'")
0
 
LVL 1

Author Comment

by:addicktz
ID: 13971644
ok using dr = Dssubs.tblsubs.Select("SELECT * FROM tblsubs WHERE group = '" & group & "'")
i got
Additional information: Syntax error: Missing operand after 'tblsubs' operator.

using
SELECT * FROM tblsubs WHERE [group] = " & group
i got
Additional information: Syntax error: Missing operand after 'tblsubs' operator.
0
 
LVL 70

Accepted Solution

by:
Éric Moreau earned 2000 total points
ID: 13971841
You are doing a select on an already filled table of a dataset. In this case, there is no SELECT clause, only a where clause:

dr = Dssubs.tblsubs.Select("WHERE group = '" & group & "'")

Depending on how dr is declared, you may have to use:
dr = Dssubs.tblsubs.Select("WHERE group = '" & group & "'")(0)
0
 
LVL 6

Expert Comment

by:carmodyk
ID: 13971934
Are you using an MS Access as your database?

if so, ok using dr = Dssubs.tblsubs.Select("SELECT * FROM tblsubs WHERE group = '" & group & "';")
0

Featured Post

What does it mean to be "Always On"?

Is your cloud always on? With an Always On cloud you won't have to worry about downtime for maintenance or software application code updates, ensuring that your bottom line isn't affected.

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Since .Net 2.0, Visual Basic has made it easy to create a splash screen and set it via the "Splash Screen" drop down in the Project Properties.  A splash screen set in this manner is automatically created, displayed and closed by the framework itsel…
Calculating holidays and working days is a function that is often needed yet it is not one found within the Framework. This article presents one approach to building a working-day calculator for use in .NET.
this video summaries big data hadoop online training demo (http://onlineitguru.com/big-data-hadoop-online-training-placement.html) , and covers basics in big data hadoop .
Please read the paragraph below before following the instructions in the video — there are important caveats in the paragraph that I did not mention in the video. If your PaperPort 12 or PaperPort 14 is failing to start, or crashing, or hanging, …
Suggested Courses

834 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question