• Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 345
  • Last Modified:

SELECT Question

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
addicktz
Asked:
addicktz
1 Solution
 
sajuksCommented:
group is a reserved word
try placing that within square brackets
SELECT * FROM tblsubs WHERE [group] = " & group
0
 
doobdaveCommented:
Hi addicktz,

what is the error msg you're getting?
0
 
Éric MoreauSenior .Net ConsultantCommented:
"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
Free Tool: Site Down Detector

Helpful to verify reports of your own downtime, or to double check a downed website you are trying to access.

One of a set of tools we are providing to everyone as a way of saying thank you for being a part of the community.

 
carmodykCommented:
Try this

dr = Dssubs.tblsubs.Select("SELECT * FROM tblsubs WHERE group = '" & group & "'")
0
 
addicktzAuthor Commented:
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
 
Éric MoreauSenior .Net ConsultantCommented:
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
 
carmodykCommented:
Are you using an MS Access as your database?

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

Are you are experiencing a similar issue? Get a personalized answer when you ask a related question.

Have a better answer? Share it in a comment.

Join & Write a Comment

Featured Post

Cloud Class® Course: CompTIA Cloud+

The CompTIA Cloud+ Basic training course will teach you about cloud concepts and models, data storage, networking, and network infrastructure.

Tackle projects and never again get stuck behind a technical roadblock.
Join Now