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: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003
This is the forum to discuss the Wrox book Professional VB.NET 2003 by Bill Evjen, Billy Hollis, Rockford Lhotka, Tim McCarthy, Jonathan Pinnock, Rama Ramachandran, Bill Sheldon; ISBN: 9780764559921
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 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 Search this Thread Display Modes
  #1 (permalink)  
Old June 12th, 2003, 08:21 AM
Registered User
 
Join Date: Jun 2003
Location: Atlanta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default DataSet example, Chapter 16

I set up MSDE that came with VS.NET and, using the Server Explorer, created a database called 'pubs' on my server. The MSSQLServer icon is lit up in the System Tray and has been started. When I created 'pubs', I was prompted whether I wanted to use NT Integrated Security or SQL Server Authentication. I was forced to choose the NT option because any login name that I used, including my administrator account, the 'aspnet_wp account', 'SQLDebugger' and 'sa'. Every time I tried to use the SQL Server Auth. option, I would get the following error prompt:

ADO Error: '
Login failed for user 'whateverItried'. Reason: Not associated with a trusted SQL Server connection.

When running the following:

Dim myConnection As SqlConnection = New SqlConnection("server=(local);database=pubs;uid=sa ;pwd=")

it would result in this error message:

Index #0
Error: System.Data.SqlClient.SqlError: SQL Server does not exist or access denied.

I also tried using 'localhost' and <my-computername>\<my-servername> for the server. For my database name, I tried both pubs and dbo.pubs. I also tried every username I could think of.

No luck.

Here's the funny thing: I was able to create a View on the database that did exactly what I was trying to do in code, so the DB is working.

I've tried switching the LoginMode in the registry to 2 (hex) and I've also tried to use a different SQLConnection string:

("Initial Catalog=pubs;Data Source=localhost;Integrated Security=SSPI;")

If anyone has sucessfully ran the first example program in Chapter 16 of Beginning VB.NET 2nd edition, please respond and let me know what I'm doing wrong. I really want to understand this stuff!
  #2 (permalink)  
Old June 12th, 2003, 12:36 PM
Authorized User
 
Join Date: Jun 2003
Location: Cowes, IOW, United Kingdom.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JonathanC
Default


Hi jtimms

Sorry to hear you are having so much trouble.

Can you tell me if you have tried what is outlined below?

If you click on your SQL Server Service Manager (in your tray)
The dialog that pops up has two comboboxes marked as Server and Services.
Do you have more than one Server entry in the box, named instances perhaps?

Have you tried the full instance name in your connectionstring?

(example below, look at the Data Source argument)

Provider=SQLOLEDB;Data Source=myserver\myinstance;Initial Catalog=Pubs;User ID=sa;Password=yourpassword;"

You mentioned changing the LoginMode in the registry, make sure the value is 2 (Mixed Mode)

If this is an answer for your problem you can read more about it
here:
http://support.microsoft.com/?kbid=319930

If it is not an answer and you are still struggling, let me know, so I can try to help you further.







Jonathan Crossland
http://www.jonathancrossland.com
  #3 (permalink)  
Old June 15th, 2003, 11:20 PM
Registered User
 
Join Date: Jun 2003
Location: Atlanta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey Jonathan,
Yeah, I've now tried the full instancename for my connection string. I also tried to use the Provider setting, but I got an exception when making the connection, so I had to take it out.

Here's my newest one:

New SqlConnection("Data Source='localhost';Initial Catalog='pubs';Integrated Security='SSPI';Workstation ID='WOOLLY-01';user id='sa';password=''")

I know now that I'm actually getting a SqlException when calling the Open method on the Connection object. The only SqlError has a severity level of 20. The type of error is 17. I have no idea what that means, though.

Does that give you any more to work with?

Thanks,
Jason
  #4 (permalink)  
Old June 15th, 2003, 11:56 PM
Authorized User
 
Join Date: Jun 2003
Location: Cowes, IOW, United Kingdom.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JonathanC
Default


Hi Jason

I copied your connectionstring and changed names and places and it works on my box.
It is hard to know exactly what is wrong here.
I have more suggestions here for you to try though.

1.
Double check your password.
If its blank then leave it blank (no quotes or apostrophes)
Check your case and spelling.

2.
You could also check in your EventLog. SQL-Server will write an entry for every error with this kind of severity. Perhaps this can help us.

3.
Try the following Connectionstrings
a) "Data Source=localhost;Initial Catalog=pubs;user id=sa;password="
b) "Data Source=localhost;Integrated Security=SSPI;Initial Catalog=pubs;"

4.
Try opening your server and database via the server explorer toolbar in VS.NET.
Open your sql-server node and select a database. In the properties window you will see properties for the database including a connectionstring. If it connects to your database here, look at the connectionstring property. Maybe you can post it here.

Let me know :)
Good luck






Jonathan Crossland
http://www.jonathancrossland.com
  #5 (permalink)  
Old June 16th, 2003, 07:36 AM
Registered User
 
Join Date: Jun 2003
Location: Atlanta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Wow, that's weird.

Well, I think the password for the username 'sa' is blank. When I tested the connection using the .udl file properties dialog box, it worked using either NT auth w/o a username/password combo and it also worked with SQL auth w/ username 'sa' and no password. It tested it with 'sa' and an arbitrary password and I got an error, so I'm thinking the pw is correct.

Here's something interesting I found in the EventViewer, which has been occuring whenever I boot up my OS:

Event Type: Warning
Event Source: MSSQL$VSDOTNET
Event Category: (8)
Event ID: 19011
Date: 6/16/2003
Time: 12:24:03 AM
User: N/A
Computer: WOOLLY-01
Description:
The description for Event ID ( 19011 ) in Source ( MSSQL$VSDOTNET ) cannot be found. The local computer may not have the necessary registry information or message DLL files to display messages from a remote computer. You may be able to use the /AUXSOURCE= flag to retrieve this description; see Help and Support for details. The following information is part of the event: (SpnRegister) : Error 1355.

No errors, though, in the event viewer.

I tried both of the connection strings with no luck, but since my server explorer has been working like a champ, I was able to get the connection string that it's been successfully using:

Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=True;Initial Catalog=pubs;Data Source=WOOLLY-01\VSDOTNET;Use Procedure for Prepare=1;Auto Translate=True;Packet Size=4096;Workstation ID=WOOLLY-01;Use Encryption for Data=False;Tag with column collation when possible=False

However, when I tried to cut and paste this one in, it didn't like some of the arguments (i.e. it couldn't figure out what 'Provider' was:

An unhandled exception of type 'System.ArgumentException' occurred in system.data.dll
Additional information: Unknown connection option in connection string: provider.

The event viewer warning seems kind of strange because I'm not trying to connect to a remote computer. I'm really curious of what the "/AUXSOURCE=" flag should be called on.

As for the connection string, some of the longer arguments don't work either, like "Use Encryption for Data=False". Maybe there's a shorter argument name for this, but I've not found it yet.

Jason
  #6 (permalink)  
Old June 16th, 2003, 08:48 AM
Authorized User
 
Join Date: Jun 2003
Location: Cowes, IOW, United Kingdom.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JonathanC
Default

Jason

strange indeed.

By what I can see in the VS.NET generated version of your connectionstring
all you should require is

"Data Source=WOOLLY-01\VSDOTNET;Integrated Security=SSPI;Initial Catalog=pubs;"

But you say this doesn't work :(
Do you have any firewall software running?

Do you know the osql command? if you don't (link to KB article)-
try using osql command to connect to the database and reset password etc.

http://support.microsoft.com/default...;en-us;Q325022

Other than that, I am not sure what else I can offer
Unless we are both missing something obvious!

not a nice suggestion but here goes
Perhaps a reintall is in order?


Jonathan Crossland
http://www.jonathancrossland.com
  #7 (permalink)  
Old June 16th, 2003, 09:54 AM
Registered User
 
Join Date: Jun 2003
Location: Atlanta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

I'll try reseting the password, but as for reinstalling, this box is pretty new (fresh OS and IDE, that is.) I just did a full install of XP Pro (from XP Home) so I could take advantage of IIS.

So far chapter 17's examples are working just fine.

I do want you to know that I've thoroughly enjoyed your book and except for not having access to Access and not being able to get Ch16's examples to work, I've really learned a lot.

Chapter 18 (XML) was my favorite and I think I will persue that language further, now that I've got an idea of what it can do for you.

I'm now going through Wrox's XHTML book, and soon, I'll be going on to a book on Managed C++ Extentions (C++ is where most of my professional experience lies.) I've recently loaded Active Python on my box and I'm trying to learn to write ASP with PyScript instead of the other "Two." Python's neat, but I can't find too many examples for my level of experience with it, I'm just past where a beginner would be and I don't quite understand the advanced examples. Maybe I should buy a cookbook on it.

Anyway, as for my problem, now, maybe someone else will come along with the same problem and we can help each other out.

You know, it could be the version of MSDE that came with my VS.NET. It was the Academic version after all.

Where could I get a fresh version of MSDE?

Thanks,

Jason
  #8 (permalink)  
Old June 16th, 2003, 05:23 PM
Authorized User
 
Join Date: Jun 2003
Location: Cowes, IOW, United Kingdom.
Posts: 44
Thanks: 0
Thanked 0 Times in 0 Posts
Send a message via MSN to JonathanC
Default

:)

http://www.microsoft.com/sql/msde/downloads/default.asp

Jonathan Crossland
http://www.jonathancrossland.com
  #9 (permalink)  
Old June 17th, 2003, 09:05 AM
Registered User
 
Join Date: Jun 2003
Location: Atlanta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hmm...

I can't figure it out. Even with the new and improved MSDE, I'm still receiving the severity 20 SQLException on the SQLConnection.Open method.

Maybe, the Academic version of Visual Studio .NET has the capabilities blocked from doing database work.

I'm stumped on this one.

Is there a class to use, other than SQLConnection, to do ADO programming in VB.NET?

Or, it could be that /AUXSOURCE= flag that's not being set when MSDE starts.

Jason

Quote:
quote:Originally posted by JonathanC
 :)

http://www.microsoft.com/sql/msde/downloads/default.asp

Jonathan Crossland
http://www.jonathancrossland.com
  #10 (permalink)  
Old June 18th, 2003, 08:46 PM
Registered User
 
Join Date: Jun 2003
Location: Atlanta, GA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hey, here's an idea. I could be setting MSDE up wrong. For some reason, I can't seem to install the "new" MSDE to the same location as the one that came with VS.NET 2002.

The first time I tried it, the service couldn't find my computer or server. The second time it named the instance the same as my computer's name.

Could you let me know the arguments that you used for your setup.exe for MSDE?

I didn't have to use one originally, but the new one that you provided a link to previously requires at least the SAPWD flag.

Thanks,

Jason
 


Thread Tools Search this Thread
Search this Thread:

Advanced Search
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
Try it out:Ch 16 Dataset Example flhartley VB.NET 2002/2003 Basics 1 August 28th, 2009 07:00 AM
Chapter 16 Fig 16-11 krsouthern BOOK: Professional SharePoint 2007 Development ISBN: 978-0-470-11756-9 1 July 8th, 2008 12:11 PM
Chapter 16 boyce0324 VB.NET 2002/2003 Basics 1 June 5th, 2007 01:59 AM
Chapter 16 - DataSet Example - MODIFIED??? cliffd64 VB.NET 2002/2003 Basics 2 May 17th, 2005 12:52 PM
Chapter 16, DataSet Example danascmitz VB.NET 2002/2003 Basics 6 January 5th, 2004 05:11 AM



All times are GMT -4. The time now is 04:33 PM.


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