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: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer
This is the forum to discuss the Wrox book Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer by Rod Stephens; ISBN: 9780470596906
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Stephens' C# Programming with Visual Studio 2010 24-Hour Trainer 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 Display Modes
  #1 (permalink)  
Old December 7th, 2013, 04:33 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson38TryIt_LINQtoSQL

Hi
I have ”MS Visual Studio 210 Express” & “MS Server SQL 2008”, and was unable to find “Server Explorer” window.
So I also installed, ”MS Server SQL 2008 R2”, still no “Server Explorer” window.

After browsing MS help I discovered that “…In the Visual Studio express products, this window is named “Database Explorer”. In all other Visual Studio products, this window is named “Server Explorer”….” That solved one problem.

Reading helps, so I also read John S’s post about “Lesson 38 Building Customer Databases”.

I ran the program “BuildCustomerDatabase” (as per note on p424) using:
a) GOTHMOG\sqlsexpress threw an “error opening database” “…the server was not found or was not accessible…”
b) ./SQLExpress threw an “Error opening database” “..The server was not found or not accessible.Verify that the instance name is correct and that SQL Server is configured to allow remote connection …...”
c) .\sqlexpress & \sqlexpress & SQLEXPRESS had similar outcome.
The “Add Connection” in my Database Explore is different in appearance to that in Figure 38-4. I do not have a “Server Name”.

Before running “BuildCustomerDatabases” I clicked on “Add Connection” in the “Database Explorer” window to amned the Data source and Database file name as per “Figure 38-4” (minus the Server name” and I was able to create a *.mdf file).
I am a tad lost to say the least.

1) How can I “Create Database” using BuildingCustomerDatabase.
2) I am unable to successfully run any of your downloads in Lesson 38??
3) What have I missed? Lots I presume.
Thanks
Wendel
Reply With Quote
  #2 (permalink)  
Old December 8th, 2013, 07:34 PM
Rod Stephens's Avatar
Wrox Author
Points: 3,141, Level: 23
Points: 3,141, Level: 23 Points: 3,141, Level: 23 Points: 3,141, Level: 23
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jan 2006
Location: , , .
Posts: 640
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Wendel,

Unfortunately database programming is very common so Microsoft seems to think they need to change how it works constantly to make things better. (I also think they rename things to make you feel like the new version of Visual Studio or Windows or whatever is new so they can try to make you get a new version every 2 years.) All of that makes it hard to write (or follow) perfect instructions.

Quote:
After browsing MS help I discovered that “…In the Visual Studio express products, this window is named “Database Explorer”. In all other Visual Studio products, this window is named “Server Explorer”….” That solved one problem.
Perfect example. They rename things and move them around in different versions and different editions. Sorry about this was hard to find.

Quote:
I ran the program “BuildCustomerDatabase” (as per note on p424) using:
a) GOTHMOG\sqlsexpress threw an “error opening database” “…the server was not found or was not accessible…”
GOTHMOG is the name of my server. You need to use SQL Server's tools to start your server and create a database on it.

Quote:
b) ./SQLExpress threw an “Error opening database” “..The server was not found or not accessible.Verify that the instance name is correct and that SQL Server is configured to allow remote connection …...”
I think that should work for SQL Server Express. But it sounds like you have the real SQL Server installed and that's different (although similar).

Quote:
c) .\sqlexpress & \sqlexpress & SQLEXPRESS had similar outcome.
The “Add Connection” in my Database Explore is different in appearance to that in Figure 38-4. I do not have a “Server Name”.
I'm not sure which combinations should work. I don't think it is case-sensitive so at least that shouldn't be an issue.

Quote:
1) How can I “Create Database” using BuildingCustomerDatabase.
At this point, it mat be easiest to search for SQL Server 2008 information that explains how to create a database. Then you can try to write a program to connect to it.

After you create the database, you should be able to see it in Database Explorer and make a connection to it.

Quote:
2) I am unable to successfully run any of your downloads in Lesson 38??
I don't think you'll be able to run those programs until you create a database and change the name from GOTHMOG to whatever is appropriate for your system.

Quote:
3) What have I missed? Lots I presume.
The real key is creating the database. I know from painful experience what a confusing mess all that is. And the SQL Server tools are not great.

Here's a page that explains how to create a database with the Management Studio tool. (You might need to install that tool separately. It's a Microsoft download and if I remember correctly the installation isn't too bad.)
How to: Create a Database (SQL Server Management Studio)
Here's a YouTube video showing how to build a database and table.
SQL Server 2008 - Create Database and table
It also uses SQL Server Management Studio. You can download it here if you need it:
SQL Server 2008 Management Studio Express
At least I think that version should work.

Sorry this is such a confusing pain. Keep us posted on your progress!
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

(Please post reviews at Amazon or wherever you shop!)
Reply With Quote
  #3 (permalink)  
Old December 14th, 2013, 01:40 AM
Authorized User
Points: 96, Level: 1
Points: 96, Level: 1 Points: 96, Level: 1 Points: 96, Level: 1
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: Aug 2013
Posts: 22
Thanks: 0
Thanked 0 Times in 0 Posts
Default Lesson38TryIt_LINQtoSQL

Hi Rod
After a bit of trial and error I was able to successfully download SQLServerManagementStudio.
I kept getting error message (after downloading and running SQLManagementStudio_x64ENU.exe & SQLManagementStudio_x86ENU.exe) saying that:
“Another version of MS Visual Studio 2008 has been detected on this system that must be updated to SP1. Please update all Visual Studio 2008 installations to SP1 level, by visiting Microsoft Update.”
Sadly to say there was no "..update to SP1" and my previous attempt at downloading “..update to SP3” was not too successful.
MS was able to provide a solution by running “Uninstall Visual Studio 2008 RTMC/RC components” and then installing SQLServerManagementStudio.
Success, so I thought.

Not sure if you can decipher from my ramblings that follow, if I have managed to download the required software? Maybe Mr Microsoft wants me to buy MS Studio.
I am able to create *.mdf & *.sdf dataBases, but I can’t create a *.mdf database file using SQLServerManagementStudio.
I cannot see or select “MS SQL Server(SqlClient)” in Add Connections as per p425.

When I try to connect to CustomerDatabase.mdf in C# – I get an error message “Cannot open user default database. Login failed for user “Wendel-PC-Wendel””. Maybe some things are just not meant to be?

Regards
Wendel


My ramblings: ( creating a db and attempting to link to it)
MS SQL Server Management Studio
Server type = Database Engine (or SQL Server Compact Edition)
Server name = WENDEL-PC
Authentication = Windows Authentication
Connect
Location = C:\Program Files (x86)\Microsoft SQL Server\MSSQL10_50.MSSQLSERVER\MSSQL\DATA.
db =MyCustomerDatabase.mdf
TableName = dbo.MyCustomers
Columns = FirstName, LastName, Balance & DueDate.


P423 – Connect to db – Create Windows Forms application in C# / Add Connection
Data source = MS SQL Server Compact 3.5
Db = FileName is blank

Db =C:\Users\Wendel\Documents\Customers.sdf (Test Connection = ok) (compact edition)

Db = C:\Users\Wendel\Documents\Customers.mdf (Test Connection = ok) [unable to connect]
SQL Man Tool
Db ==C:\Users\Wendel\Documents\Customers.sdf (Test Connection = ok) (compact edition)
(Connect = ok)
C# - Test Connection = ok
On moving Customers table from Database Explorer to CustomerssdfDataClasses.dbml –
Error message = The selected objects use unsupported data provider
Reply With Quote
  #4 (permalink)  
Old December 14th, 2013, 11:57 AM
Rod Stephens's Avatar
Wrox Author
Points: 3,141, Level: 23
Points: 3,141, Level: 23 Points: 3,141, Level: 23 Points: 3,141, Level: 23
Activity: 50%
Activity: 50% Activity: 50% Activity: 50%
 
Join Date: Jan 2006
Location: , , .
Posts: 640
Thanks: 2
Thanked 96 Times in 95 Posts
Default

Hi Wendel,

Sorry this is such a pain. (It's actually one of my all-time least favorite parts of programming: trying to follow the bizarre instructions Microsoft gives you to install an over complicated tool just to do something relatively simple.)

Did you use Windows Update to check for updates? That's probably worth doing just in case, even if it is lying to you about SP1 and other service packs.

Quote:
Maybe Mr Microsoft wants me to buy MS Studio.
I wouldn't give him the satisfaction! I know this can be done without buying any products. Unless you want those products for some reason, I wouldn't spend any money on it.

The big trick is finding a combination of free products that work together.

Quote:
I cannot see or select “MS SQL Server(SqlClient)” in Add Connections as per p425.
Can you see anything that looks related to SQL Server in the Add Connection dialog?

Quote:
When I try to connect to CustomerDatabase.mdf in C# – I get an error message “Cannot open user default database. Login failed for user “Wendel-PC-Wendel””.
Is SQL Server running? One of the things about SQL Server that I don't particularly like is that it must be running to use a database. I'm not sure whether you need to have it running to use the mdf file.

Sorry I'm not much help but I'm not really an SQL Server guru. You'll probably get better instructions by searching the internet.

Quote:
Maybe some things are just not meant to be?
I'm sure you can get it running. The question is, how much effort do you want to spend on it.

Quote:
C# - Test Connection = ok
That sounds promising!

Quote:
On moving Customers table from Database Explorer to CustomerssdfDataClasses.dbml –
Error message = The selected objects use unsupported data provider
That sounds less promising.

Is this trying to use the designer to try to create Entity Framework classes? I think that designer has some odd issues and doesn't always understand the objects in the database. (It seems to understand SQL Server the best, though!)

There have been times when I've needed to build the design by hand to make it work.
__________________
Rod

Rod Stephens, Microsoft MVP

Essential Algorithms: A Practical Approach to Computer Algorithms

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


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



All times are GMT -4. The time now is 06:56 AM.


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