|
-
Oct 15th, 2004, 06:53 AM
#1
Thread Starter
Frenzied Member
Writing a SQL statement on serveral lines [* Resolved *]
Hello
I have a SQL statement which is long. How do l write it so that it is on serveral lines.
This is what l have tried to do.
Code:
CnnStr = "SELECT student.studentID, student.FirstName, student.LastName" +
"book.bookID, book.Title" +
"FROM student, book" +
"WHERE student.studentID = book.studentID";
This does not work, and anyone tell me how to do this.
Many thanks in advance,
Steve
Last edited by steve_rm; Oct 15th, 2004 at 07:34 AM.
steve
-
Oct 15th, 2004, 07:28 AM
#2
That should work fine, except that you are missing commas and spaces in your statement. Look at the end of each line.
Laugh, and the world laughs with you. Cry, and you just water down your vodka.
Take credit, not responsibility
-
Oct 15th, 2004, 07:34 AM
#3
Thread Starter
Frenzied Member
Hello,
Thanks for your help. I think l was thinking too much like VB. I thought with concatenation you left out the commas.
Thanks very much,
Steve
-
Oct 15th, 2004, 10:57 AM
#4
Hyperactive Member
why are you hardcoding sql into your application?. unless there is a really good reason this is an extremely bad idea. i terms of security, performance, modularity
-
Oct 15th, 2004, 10:13 PM
#5
PowerPoster
Want to do something even cooler? Check it out:
CnnStr = @"SELECT
student.studentID,
student.FirstName,
student.LastName,
book.bookID,
book.Title
FROM student, book
WHERE student.studentID = book.studentID";
That little @ sign is some powerful stuff...
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|