Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Register | FAQ | Members List | Calendar | 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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developersí questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
 
 
Thread Tools Display Modes
  #1 (permalink)  
Old December 15th, 2011, 06: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
  #2 (permalink)  
Old December 16th, 2011, 01:27 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
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!)
  #3 (permalink)  
Old December 16th, 2011, 06: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
  #4 (permalink)  
Old December 16th, 2011, 06:15 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,145, Level: 23
Points: 3,145, Level: 23 Points: 3,145, Level: 23 Points: 3,145, Level: 23
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Jan 2006
Location: , , .
Posts: 641
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!)
 


Thread Tools
Display Modes

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

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off

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 04: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



All times are GMT -4. The time now is 05:23 AM.


Powered by vBulletin®
Copyright ©2000 - 2017, Jelsoft Enterprises Ltd.
© 2013 John Wiley & Sons, Inc.