MS SQL Development
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me
Go Back   Dev Shed ForumsDatabasesMS SQL Development

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
Be the architects of evolution and help create the mobile internet future. It’s your move---enter to win here!
  #1  
Old February 29th, 2004, 03:15 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Easy Syntax problem ?!

WHERE (((Participants.Event)= Form8.Text1.Text'));"

What is the correct syntax for using a Textbox Text to denote the WHERE parameter.

I have tried many different ways and none work.

THX

Reply With Quote
  #2  
Old March 1st, 2004, 11:28 AM
sypher sypher is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Montreal
Posts: 92 sypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 10 sec
Reputation Power: 5
well first of all...what language are you using?

and usally it's like this :

Querystr:= Querystr+WHERE (((Participants.Event)= "+Form8.Text1.Text+"));

I assumed that Participants is the table
and Event is a field

Reply With Quote
  #3  
Old March 1st, 2004, 03:19 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Using Access 2000 and VB6
Correct, Participant is the Table
Event is the field
The query is in a ADODC control on the form the Textbox ison.
THX

Reply With Quote
  #4  
Old March 1st, 2004, 03:36 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Getting closer

I used your string at the end of my query but I am not sure if I should have used all of your string.
Here is my full query string together with your string

"SELECT Participants.Event, Participants.Full_Name, Participants.Phone_Number From Participants WHERE (((Participants.Event)= " + Form8.Text1.Text + "));"

I got the column headers in the DataGrid bound to the ADODC control but no data even when I have the correct event field value in the textbox.

THX

Reply With Quote
  #5  
Old March 1st, 2004, 04:55 PM
sypher sypher is offline
Contributing User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Jan 2004
Location: Montreal
Posts: 92 sypher User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 15 m 10 sec
Reputation Power: 5
are you using Access2000 or SQL?

I don't know if I wrote this or not..but try without the Form8.text1.text thing.
so you query should look like this:
"SELECT Participants.Event, Participants.Full_Name, Participants.Phone_Number From Participants WHERE (Participants.Event=2);" //2 or whatever value you know will bring data.

if Event is some text make sure you do a ' before and after you text, like this ...event='holiday');


btw I think you may have to much parentheses or something...I don't remember VB6 all that well.

Reply With Quote
  #6  
Old March 1st, 2004, 07:30 PM
BratCat2 BratCat2 is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: Feb 2004
Posts: 20 BratCat2 User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: < 1 sec
Reputation Power: 0
Thanks
I had help on this site to create the query and it does work if I explictly place a value in the WHERE Clause, I tested it first with a hardcoded value.
The problem is I have a list of names and each one has an event, I need to group all the events with the names and this query will do that but I will have many names and many different events in the future and I need to do this on a VB form dynamically for each different event. When moving to each event on the form, it shows all names that have that particular event listed with their record.



THX

Last edited by BratCat2 : March 1st, 2004 at 07:35 PM. Reason: Forgot some info

Reply With Quote
Reply

Viewing: Dev Shed ForumsDatabasesMS SQL Development > Easy Syntax problem ?!


Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


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

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump


Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 





© 2003-2008 by Developer Shed. All rights reserved. DS Cluster 3 hosted by Hostway