Wrox Programmer Forums
|
BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5
This is the forum to discuss the Wrox book Beginning Visual Basic 2005 Databases by Thearon Willis; ISBN: 9780764588945
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 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 July 6th, 2007, 07:08 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 8 - A plea to Thearon Willis

Please Please
Please could you detail the code that would replace Point 13 on Page 161, Chapter 8 - to solve what seems to be a common problem regarding Windows Integrated security to connect to SQL Server, and obviously any other code that would be required.

I like many other people have Visual Basic and SQL Server loaded on the same PC at home where no userIDs or passwords have been set up. I believe that I have to remove the references to 'User Id' and 'Password' in the WDABase class as these cause errors and replace it with 'Integrated Security=True' - but I just cannot get this to work.

I have spent hours and hours trying to solve this problem and feel that I will have to give up on Visual Basic before I have even started if I cannot find a solution to this problem. This would put an end to my dream of developing VB programs.

I have read your comments to other people regarding this same problem but still no joy. The easiest solution would be to see a snippet of code including the 'integrated security=true' references. If you could show this it would be fantastic.

I came across the same problem in one of your other books - Beginning Visual Basic 2005 - chapter 16 and had to give up on that book too - which was a great shame and frustration. On page 496 you identify the subject of integrated security - but there is no example code.

I really would be over joyed if you could help me with this problem - this is my last hope
 
Old July 7th, 2007, 02:36 PM
Thearon's Avatar
Wrox Author
 
Join Date: Dec 2003
Posts: 396
Thanks: 0
Thanked 8 Times in 8 Posts
Default

This solution is for SQL Server only to use either SQL Server Authentication as specified in the book or to use Windows Authentication which a lot of people have been asking for.

On page 161, step 13, replace the connection string code for SQL Server as follows:

        If Provider = "SQL Server" Then
            If Login.Trim.Length > 0 Then
                'Use SQL Server Authentication
                Connection = New OleDbConnection( _
                    "Provider=SQLOLEDB;" & _
                    "Data Source=" & Server & ";" & _
                    "Database=" & Database & ";" & _
                    "User ID=" & Login & ";" & _
                    "Password=" & Password & ";")
            Else
                'Use Windows Authentication
                Connection = New OleDbConnection( _
                    "Provider=SQLOLEDB;" & _
                    "Data Source=" & Server & ";" & _
                    "Database=" & Database & ";" & _
                    "Integrated Security=SSPI;")
            End If
        Else

What this code is doing is checking the length of the Login parameter passed to this class. If the length of the Login parameter is greater than zero the code will use SQL Server Authentication, otherwise it will use Windows Authentication.

You should not have to modify any other remaining code, just omit passing the Login and Password if you want to use Windows Authentication.

I have tested this code on my laptop connecting to my local database and everything works fine.

Thearon
 
Old July 10th, 2007, 03:51 AM
Registered User
 
Join Date: Jul 2007
Posts: 2
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The new code worked perfectly!

Thank you so much, it was amazing to receive the solution back so quickly. I think the fact that you are involved in this forum is excellent, and I really do appreciate your help. It's great to be able to get back to my enjoyment of the book, knowing that if I really get stuck there is help out there.

Thanks again
Petrina








Similar Threads
Thread Thread Starter Forum Replies Last Post
Another Plea for Thearon PaulBerry BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 January 26th, 2008 07:59 AM
Thearon Willis VB 2005 luisxvarg BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 4 May 23rd, 2007 10:59 PM
FOR THEARON WILLIS TAVOSOFT BOOK: Beginning Visual Basic 2005 ISBN: 978-0-7645-7401-6 3 December 12th, 2006 06:23 AM
To Mr. Thearon Willis luishrd BOOK: Beginning Visual Basic 2005 Databases ISBN: 978-0-7645-8894-5 1 May 14th, 2006 02:03 PM
Question for Fig. 5-3 P-109 of the Thearon Willis' [email protected] Forum and Wrox.com Feedback 1 September 6th, 2005 01:23 PM





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