Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > Visual Basic > VB.NET 1.0 > VB.NET 2002/2003 Basics
Password Reminder
Register
Register | FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read
VB.NET 2002/2003 Basics For coders who are new to Visual Basic, working in .NET versions 2002 or 2003 (1.0 and 1.1).
Welcome to the p2p.wrox.com Forums.

You are currently viewing the VB.NET 2002/2003 Basics 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
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old January 2nd, 2004, 03:49 AM
Registered User
 
Join Date: Jan 2004
Location: Methuen, MA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default Chapter 16, DataSet Example

I have installed MSDE, gone into the registry, and changed the 'loginmode' to 2 in the DWORD editor. When I set up MSDE, I set an 'sa' password, and 'strong named' the password. Then I rebooted.

I know I have IIS installed correctly (I have some old ASP/VB6/ODBC programs that I tested that work just fine).

The age old problem: Why do I get the "Cannot open database requested in login 'pubs'. Login Fails. Login failed for user 'COMPUTER\Default" error message? (I added a 'try/catch' around 'myConnection.open')

Are IIS/VB.NET/MDSE not talking to eachother for some reason?

Any help will be appreciated.

Thanks!

Reply With Quote
  #2 (permalink)  
Old January 2nd, 2004, 05:56 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

What does your connection string look like? Are you using Integrated Security or SQL Server Security?

And is loginmode 2 Integrated or SQL security?

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #3 (permalink)  
Old January 2nd, 2004, 09:20 PM
Registered User
 
Join Date: Jan 2004
Location: Methuen, MA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Right. That would have been good to tell you.

My connection string is:
Dim myConnection As SqlConnection = New SqlConnection("server= (local);database=pubs;uid=sa;pwd=")

Q: Are you using Integrated Security or SQL Server Security?
I shut down the MDSE, went into regedt32, and altered
HKLM\Software\Microsoft\Microsoft SQL Server\MSSQLServer\LoginMode
and changed it to '2' -- mixed mode.

Then I got out of the registry, and restarted MDSE.

I know VB6 had a whole load of 'references that had to be set for OLEDB to work -- is there anything like that in VB.NET, or does it just look like it isn't talking to MSDE?

Thanks!

Reply With Quote
  #4 (permalink)  
Old January 3rd, 2004, 05:51 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Hi there,

Your connection string looks a little weird for a Sql connection. Try this:

New SqlConnection("Data Source=(local);Initial Catalog=pubs;User ID=sa;Password=")

I think your current connection string does not pass over the User ID en Password correctly, so an Integrated connection is assumed.

Is there any specific reason why you're using mixed security? Integrated may be easier and more secure.....


Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
  #5 (permalink)  
Old January 4th, 2004, 02:51 AM
Registered User
 
Join Date: Jan 2004
Location: Methuen, MA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

The "Dim myConn As SqlConnection = New SqlConnection("server=(local);database=pubs;uid=sa ;password=")" is the code for DataSet Example in Chapter 16 of 'Beginning VB.VET 2e'.

The solution was twofold: First I downloaded a free application called "DBAMgr2K" that acts as an interface for MSDE. Secondly, I got on the phone with a (new) friend who helped me configure MSDE (with "DBAMgr2K") and hook up the pubs database so I could open it with the string above. I can now connect successfully. I verified the connection is being made with the immediate/command window. Life is good.

New problem: Now when I run the code, it runs just fine up to the line "MyDataAdapter.SelectCommand.ExecuteNonQuery() ", then I get the error, "Invalid object name 'authors'" . . . which is the table I'm trying to get at in the pubs database! I even downloaded the code for the same program off the Wrox website and it does the exact same thing . . . won't access the tables inside the pubs database.

I've seen references all over the web regarding this error message, but no solutions. Anybody out there in Wroxland ever had to fix this one?

Thanks again!

Dana

Reply With Quote
  #6 (permalink)  
Old January 4th, 2004, 08:33 PM
Registered User
 
Join Date: Jan 2004
Location: Methuen, MA, USA.
Posts: 8
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Something I should have added to the above novel: The piece of code it bombs out on is:

MyDataAdapter.SelectCommand.ExecuteNonQuery()

Regards,

Dana

Reply With Quote
  #7 (permalink)  
Old January 5th, 2004, 05:11 AM
Imar's Avatar
Wrox Author
Points: 72,045, Level: 100
Points: 72,045, Level: 100 Points: 72,045, Level: 100 Points: 72,045, Level: 100
Activity: 100%
Activity: 100% Activity: 100% Activity: 100%
 
Join Date: Jun 2003
Location: Utrecht, Netherlands.
Posts: 17,083
Thanks: 80
Thanked 1,587 Times in 1,563 Posts
Default

Did you try the connection string I showed you earlier? That's the "official" connectionstring for a SqlConnection from within .NET.

I think that the connection does not see Database as a correct term, so it tries to look in the Master database. It needs Initial Catalog instead. The stuff you're using is partly out-dated and partly wrong. The fact that you got it to work, doesn't mean it is correct ;)

Replace your connection string with this:

Data Source=(local);Initial Catalog=pubs;User ID=sa;Password="

and I think it will work.

Cheers,

Imar


---------------------------------------
Imar Spaanjaars
Everyone is unique, except for me.
Reply With Quote
Reply


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
DataSet example, Chapter 16 jtimms BOOK: Beginning VB.NET 2nd Edition/Beginning VB.NET 2003 13 October 11th, 2003 05:03 PM



All times are GMT -4. The time now is 08:30 PM.


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