Long SQL statement on a couple of lines
-
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.
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 -
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.
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, Steveadd at the beginig and end of an string a space (0x20 char) your code needs to look like this in order to work
CnnStr = " SELECT student.studentID, student.FirstName, student.LastName " + " book.bookID, book.Title " + " FROM student, book " + " WHERE student.studentID = book.studentID ";
I hope you understand... By the way... visit http://nehe.gamedev.net[^] -
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.
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, SteveYou're missing a comma after Student.LastName -- Help me! I'm turning into a grapefruit! Phoenix Paint - back from DPaint's ashes!
-
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.
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, SteveTo consolidate the above answers:
CnnStr = "SELECT student.studentID, student.FirstName, student.LastName," +
" book.bookID, book.Title" +
" FROM student, book" +
" WHERE student.studentID = book.studentID";RageInTheMachine9532 "...a pungent, ghastly, stinky piece of cheese!" -- The Roaming Gnome
-
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.
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 -
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.
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, SteveThree things: 1. You need to leave the proper spaces between things like Title and FROM. 2. You need to add a comma after LastName. 3. You can also use the @ sign in front of the string to avoid the extra quotes and + signs:
CnnStr = @"SELECT student.studentID, student.FirstName, student.LastName, book.bookID, book.Title FROM student, book WHERE student.studentID = book.studentID";
Regards, Alvaro
Our enemies are innovative and resourceful, and so are we. They never stop thinking about new ways to harm our country and our people, and neither do we. - George W. Bush