Wrox Programmer Forums
| Search | Today's Posts | Mark Forums Read
BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8
This is the forum to discuss the Wrox book Visual Basic 2008 Programmer's Reference by Rod Stephens; ISBN: 9780470182628
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Visual Basic 2008 Programmer's Reference ISBN: 978-0-470-18262-8 section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 15th, 2011, 07:35 PM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Location: Alabama
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default Typo, Chapter 20 page 416

In the code example "make the connect string" the following line is
shown as:
"Data Source= """ & txtDatabase.Text & """; " & _
"Persist Security Info= False"

Is this a typo? What is confusing is the incidence of """ in the line of code. The three (""") looks confusing. If it is a typo can anyone post
the correct text?

Thanks very much.
Cheers
 
Old December 16th, 2011, 02:27 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Code:
"Data Source= """ & txtDatabase.Text & """; " & _
"Persist Security Info= False"
That looks confusing but it's not a typo.

Visual Basic uses double quotes to delimit strings. So what if you want to put a double quote inside a string? If you tried "apple " banana" it would think the middle quote closed the string and wouldn't know what to do with banana".

To tell Visual Basic to include a quote within a string, you double it, so in this example would use "apple "" banana".

When the double quote comes at the beginning or end of a string, you get three in a row, which looks particularly odd.

So here's what the original code looks like if I replace the quotes inside the string with an X so it's easier to see:

Code:
"Data Source= X" & txtDatabase.Text & "X; " & _
"Persist Security Info= False"
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
 
Old December 16th, 2011, 07:07 PM
Registered User
Points: 27, Level: 1
Points: 27, Level: 1 Points: 27, Level: 1 Points: 27, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jul 2011
Location: Alabama
Posts: 7
Thanks: 3
Thanked 0 Times in 0 Posts
Default

OK, thanks for the very quick response.
The three double quotes just look like something isn't right.
I will give string to a textbox just to make sure I understand my
lack of understanding.

So, the string itself is passing a quote ?

I think my problem is not being up to snuff using SQL.

Once again, thanks for the reply.

Cheers
 
Old December 16th, 2011, 07:15 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,166, Level: 23
Points: 3,166, Level: 23 Points: 3,166, Level: 23 Points: 3,166, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 647
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Quote:
So, the string itself is passing a quote ?
Yup. Two of them actually. It is confusing until you've seen it a bunch.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)




Similar Threads
Thread Thread Starter Forum Replies Last Post
Chapter 20 page 669 Try It Out Step 4 Frodo BOOK: Beginning Visual C# 2010 1 December 14th, 2011 05:17 PM
Chapter 03 - Page 41 - Step 20 torr6420 BOOK: ASP.NET 4 24-Hour Trainer 1 August 23rd, 2010 10:55 AM
Try it out, Chapter 20, page 684, step 3 ron-bgsu BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 0 October 28th, 2009 08:52 AM
Chapter 1, page 11 typo? tumana BOOK Beginning Linux Programming, 3rd Edition 4 August 25th, 2006 10:43 AM
Chapter 4 typo mixtli BOOK: Beginning PHP4/PHP 5 ISBN: 978-0-7645-4364-7; v5 ISBN: 978-0-7645-5783-5 3 June 7th, 2003 06:30 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.