Starting SQL Server Browser

A number of my books contain database examples in them—most of which rely on SQL Server. One of the issues I’ve encountered over the years is that a reader will write in to say that the example doesn’t work as written. In most cases, the procedure and the example source code is just fine. In addition, there is nothing wrong with the user’s system, the Visual Studio installation, or the version of SQL Server used. The problem lies in the fact that the SQL Server Browser service isn’t started. Visual Studio relies heavily on this particular service and it isn’t started by default, in most cases, when you install SQL Server or SQL Server Express.

Unfortunately, the error message you receive will say nothing at all about SQL Server Browser. In fact, the message will complain about something completely unrelated and it may not even point to the database as the problem. This particular error has caused me (and many others) a lot of lost time. In fact, it’s such a nuisance that I immediately check to ensure the service is actually running before I look for other sources of problems (unless there is another obvious problem source). When you encounter an odd problem, especially an odd problem with source code that has worked in the past, and the application relies on a database, consider checking the SQL Server Browser service to ensure its running.

There are commonly two places in which you can look for the SQL Server Browser service. Because the SQL Server tools don’t install with the copy of SQL Server Express that comes with Visual Studio, I’ll discuss the place that everyone can look first, which is the Services console found in the Administrative Tools folder of the Control Panel. Simply open the console up, locate the SQL Server Browser entry, and ensure that it’s running as shown here.

SQLServerBrowser01

Notice that the service is set to start automatically each time the machine is booted. Using this setting usually ensures that the service will be available when needed. However, don’t assume that this setting means the service is always going to be available. If the service encounters a problem during the boot process, there is every chance that it won’t be available when you need it. Always verify that the service is indeed running when you encounter problems.

You can start a service by clicking the Start link on the left side of the right pane. The figure shows the Stop, Pause, and Restart options because the services is already started, but the Start option will appear when the service is stopped. If the service isn’t set up to start automatically, right click the service’s entry in the list and choose Properties from the context menu. Set the Startup Type field value to Automatic and click OK to configure the service to start automatically.

The second place you can look for this setting (when you have the SQL Server tools installed) is the SQL Server Configuration Manager. You’ll find the SQL Server Browser entry in the SQL Server Services folder as shown here.

SQLServerBrowser02

Again, make sure the service is actually running and that you have it configured to start automatically. Otherwise, you’ll find that you spend a lot of time chasing ghost problems that don’t actually exist. Of course, I’m always here to help you with any book-related problems you might have. Feel free to contact me about any issues with my books at John@JohnMuellerBooks.com.

 

Installing and Managing Third Party Products

Most of my books make recommendations about third party products that you can use to enhance your computing experience. Each of these products is tested during the writing process, but without any of the add-on applications that may come with the product. For example, if I test a Windows enhancement product, I don’t test the toolbar that comes with that product. So, it’s important to realize that the advice you obtain in the book doesn’t include those add-on features.

However, it’s important to take a step back at this point and discuss why the product includes an add-on in the first place. Just like you, the product vendor has bills to pay and must obtain money from somewhere to pay them. An important concept to remember when working with computers is that free doesn’t exist. Typically, product vendors who offer free products will do so by paying for them in one of these ways:

  • Advertisements: Advertising comes in many forms, not just banner ads. Marketing types constantly come up with new ways to advertise products and induce you to buy them. A developer can obtain payment from advertisements in several ways, such as referral fees.
  • Product Add-ons: A developer can provide the means to install other products with the product that you’re installing. The company who provides the additional product sponsors the free product that you’re using.
  • Marketing Agreements: The application collects information about you and your system when you install it and the developer sells this information to marketing companies.
  • Value-added Products: The free product that you’re using is just a sample of some other product that the developer provides. If you like the free product, the developer is hoping that you’ll eventually purchase the full-fledged product.
  • Government Grants: A developer creates a product after obtaining a grant from the government. You pay for the product through your taxes.
  • Sponsorship: A larger company supports a developer’s work to determine whether the idea is marketable or simply the seed of something the larger company can develop later. You pay for the product through higher prices when you buy something from the larger company.

There are other methods that developers use to get paid for their work, but the bottom line is that they get paid. Whenever you see free, your mind should say, “This product doesn’t cost money, but there is some other price.” You need to decide whether you’re willing to pay the price the developer is asking. In the case of a government grant, you’ve already paid the price.

When you install a free product, you must watch the installation routine carefully. In almost every case, you must opt out of installing add-on products that the free product supports. So, you have to read every screen carefully because these opt-out check boxes are usually small and hard to see. The developer really isn’t pulling a fast one—just trying to earn a living. Make sure you clear any check boxes you see for installing add-on products if you don’t want that product on your machine. The reason I don’t discuss these check boxes in my books is that they change constantly. Even if I were to tell you about the check boxes that appeared at the time I installed the free product, your experience is bound to be different.

Of course, you might accidentally install one of these add-ons, an add-on that you really didn’t want. In this case, you must locate the product in the list of products installed on your system, such as the Programs and Features applet of the Control Panel for Windows users. The product name won’t be straightforward, but a little research will help you find it. Simply uninstall the add-on product. However, it’s always better to avoid installing something you don’t want to begin with, rather than remove it later, because few applications uninstall cleanly (even those from larger vendors such as Microsoft).

Unfortunately, there isn’t much I can do to help you when you install an add-on product. I do have some experience with the third party product in my book, but I won’t know anything about the add-on product. You need to contact the developer of the third party product to ask for advice in removing it from your system. This may seem like I’m passing the buck, but the truth is that the add-on products change all the time and there simply isn’t any way I can keep up with them all. When in doubt, don’t install a product, rather than being sorry you installed it later. Let me know your thoughts on third party products at John@JohnMuellerBooks.com.

 

Adding a Web Reference in Visual Studio 2010 (Part 2)

Some time ago I provided some step-by-step instructions for creating both a Web Reference and a Service Reference in Visual Studio 2010 in the Adding a Web Reference in Visual Studio 2010 post. In addition, the post explains the difference between the two to make it easier to understand when to use one over the other. The post has proven popular and a number of people have commented on it.

There are a number of questions about the post though and I wanted to answer them in this follow up post. The biggest question is where the WeatherSoapClient class comes from. The WeatherServiceClient() part of the code comes from the way in which Visual Studio interacts with the WSDL. If you look at:

http://www.deeptraining.com/webservices/weather.asmx?WSDL

you find that the WSDL doesn’t contain the word Client either. The WeatherServiceClient class is generated by Visual Studio in response to the WSDL it finds on that site.

 

Another complaint about that original post is that it relies on C#. Just to make things different, this post uses Visual Basic instead. Creating the Service Reference works precisely the same as it does with C#.


To see how this works, go ahead and create a Service Reference as specified in the original post. When you get done creating just the Service Reference, choose View | Class View in Visual Studio. You’ll see a new Class View window open up. Now, drill down into your project. If you create your example using Visual Basic, you’ll see something very similar to this:

WebService011

(The C# view of the dialog box is almost precisely the same.) What you’re seeing here is the result of creating the WeatherService Service Reference. I didn’t do anything else at all to this project. Highlighted in the upper window is the WeatherSoapClient referenced in my article. In the lower window you see the methods associated with that class.

Once you get done, you can recreate the example in Visual Basic. Just add two textboxes (txtCity and txtWeather) and one button (btnTest) to your application. Create an event handler for btnTest. Here’s the code you need to make it work:

Private Sub btnTest_Click(sender As System.Object, _
                          e As System.EventArgs) _
                       Handles btnTest.Click
 
   ' Create an instance of the Web service.
   Dim Client As WeatherService.WeatherSoapClient = _
      New WeatherService.WeatherSoapClient()
 
   ' Query the weather information.
   Dim Output = From ThisData _
      In Client.GetWeather(txtCity.Text) _
      Select ThisData
 
   ' Clear the current information and
   ' output the new information.
   txtWeather.Text = ""
   For Each Letter In Output
      txtWeather.Text = txtWeather.Text + Letter
   Next
End Sub

As you can see, the code is similar to the C# version I provided in the previous post. The point is that you really do need to use the Class View at times to determine how to interact with a Web service after you create either a Web Reference or a Service Reference. My book, LINQ for Dummies, provides a lot more in the way of helpful information on using Web services effectively for queries. If you want a simpler view of Web services using the C# language, check out C# Design and Development instead. Now you know that the names used by other authors don’t come out of thin air either, even though it might seem that way at times. Please let me know if you have any other questions about this example at John@JohnMuellerBooks.com.

 

Web Services and Protocols

A number of my books (such as HTML5 Programming with JavaScript For Dummies, Start Here! Learn Microsoft Visual C# 2010 Programming, Professional Windows 7 Development Guide, and LINQ for Dummies) discuss Web services and how to access them. As developers become more and more pressed for time, using code that has been debugged and tested by someone else becomes extremely tempting. Web services provide free or paid access to someone’s code in a specific manner. Using Web services is the only way that many organizations can deliver robust applications on time and within budget today. That’s the reason Web services figure prominently in previous books and will become even more important in upcoming books.

If every one of these Web services used a different set of low-level rules to provide access, it would be a nightmare for developers to access them. Fortunately, Web services generally use one of two methods of low-level access: Simple Object Access Protocol (SOAP) or REpresentational State Transfer (REST). Most developers assume that one or the other protocol is best, but a recent article that I wrote, “Understanding SOAP and REST Basics” points out that you actually need to be proficient with both protocols to get the most out of the resources available online. The overall point of this article is that a well-equipped developer can make things happen quickly by using the best Web service for a particular task, irregardless of the underlying protocols that it uses.

Web services still have many differences. In most cases, the differences are due to individual team perspectives of the task at hand, rather than some requirement for exposing the data in a certain way. A few of these differences are incredibly convoluted. Sending REST requests where you include data as part of the request header is one example of a needlessly cumbersome method of transferring information. The need to send every SOAP request as pure XML creates ticklish situations at times. Future standards (and there will be many) will help smooth these differences out and make Web service access even easier.

The use of Web services as a programming strategy is still in its infancy, so you should expect to see some major changes as more developers rely on Web services as a basic programming tool. What are some of the most pressing problems you see with SOAP and REST today? Do you feel there will be a third standard that marries the best features of the two standards and also adds a few features of its own? What sorts of Web services would you like to see in the future? Let me know your thoughts on the topic at John@JohnMuellerBooks.com.

 

Checking SQL Server Status

A number of my books rely on database access and one of the most common servers that I’ve used in the past is SQL Server. In order to access any server, the server must be running. It only makes sense that you can’t access something that isn’t listening. The problem is that SQL Server may not start automatically for a number of reasons on your system and that Visual Studio doesn’t always make it apparent that the server isn’t running. You may get a nebulous message when you try to make a connection that doesn’t tell you anything. (No, SQL Server doesn’t start automatically when you make a request for data.) With this in mind, a post of checking the status of SQL Server is important.

Normally, I would tell you to use the tools that come with SQL Server to check the status of the server. However, some versions of SQL Server Express Edition install without the standard tools now, such as SQL Server Management Studio. Without access to these tools, it may seem as if checking the server status is impossible. Fortunately, you have other options.

The best way to check the status of SQL Server on your system is to use the Services console found in the Administrative Tools folder of the Control Panel. The Services console is one of a number of Microsoft Management Console (MMC) snap-ins that Windows installs automatically for you. However, to use this console, you must have administrator rights on the target system. Without these rights, you truly are out of luck in checking the status of your SQL Server setup and will need to get an administrator to help you.

Open the Services console and you find a list of all of the services installed on your system. Scroll down the list and you should find one or more SQL Server entries like the ones shown here.

ServicesConsole

In order to work successfully with the examples in my book, you should have SQL Server set to start automatically. In addition, when you check the service, you should see Started in the Status column as shown in the screenshot. If you don’t see Started, then highlight the service as shown and click the Start link you see on the left side (not shown in this case because the service is already started).

To make the examples easier to work with, you should also ensure that the SQL Server Browser service is started. This service makes it possible for Visual Studio to find the SQL Server installation on your system. Without this service, you must correctly type the name of the SQL Server installation you want to use when creating a connection, which is both time consuming and error prone.

If you find that you encounter problems making database examples in my books work, please check the status of SQL Server to ensure the service is actually started. Contact me at John@JohnMuellerBooks.com if you experience any other connectivity problems. I may not be able to fix every problem you encounter, but I often have a good idea of what problems you might be seeing on your system and will do my best to help you.

 

Interesting Additions to the Dummies Site

I’ve written a number of Dummies books over the years so I check on the Dummies site regularly to see what sorts of things the publisher is currently offering. Of course, there are always new books to read in a broad range of categories. Sometimes I like to browse just to see some of the interesting topics people have come up with over the years. For example, there is a book specifically for Yorkshire Terrier owners named, “Yorkshire Terriers for Dummies.” I keep hoping to find a Dummies book on Border Collies, but so far, no one has taken up the topic. Perhaps I’ll suggest such a book in the future since we work quite a bit with that particular breed. Keeping up with the wide range of books makes it a little easier for me to recommend books to my readers when they ask and I sometimes get a new idea or two simply by browsing through the topics pursued by others.

There are a couple new additions to the Dummies site that you might find interesting. First, if you really want a tee-shirt, coffee mug, or key chain (amongst other items) to show your love for Dummies products, you can get them at For Dummies Merchandise. I was a bit surprised to find that the site doesn’t offer hats at the moment, but perhaps that will change in the future.

Second, if you’ve ever wanted to create your own Dummies book, you can at least generate the cover now at The Official For Dummies Cover Generator. What you’ll get is a novelty cover that includes your title, bullet points, and art. Personally, I found some of the sample covers hysterical, so it’s worth a look even if you don’t intend to generate a cover. You’ll find titles such as Training Your Cat to Play Fetch for Dummies. Interestingly enough, our cat Smucker does, in fact, play fetch. So that particular cover caught my eye immediately.

The point behind these offerings is to have a bit fun with Dummies products. Even though the books cover serious topics, they’ve always done it is in a fun way, which is one of the reasons I’ve enjoyed writing for them so much. Let me know about your favorite Dummies site addition at John@JohnMuellerBooks.com.

 

.NET Framework Version Error When Installing Visual Studio 2012

I received a few messages from readers recently asking about an error message they receive when trying to install the release version of Visual Studio 2012 on their Windows 8 system (I imagine that the same error will occur when installing on Windows Server 2012, but no one has contacted me about it). The error says that Visual Studio 2012 can’t install because the version of the .NET Framework 4.5 is wrong.

Unfortunately, the error message isn’t very helpful. You can’t install a new version of the .NET Framework 4.5 over the top of the existing installation. In addition, you can’t uninstall the old version and then install the new version because Windows 8 requires the .NET Framework 4.5 for certain operating system elements. In short, there isn’t any apparent way to fix the problem.

The issue will go away at some point because it originates as a conflict between the Windows 8 version and the Visual Studio 2012 requirements. Every reader who has had this problem is using a non-released version of Windows 8 (normally the RC version). You can’t install the release version of Visual Studio 2012 on a non-release version of Windows 8. I’m assuming that the same error occurs if you try to install a release version of Visual Studio 2012 on a non-release version of Windows Server 2012, but I’d like to hear if anyone has tried this out at John@JohnMuellerBooks.com.

What concerns me about this particular error is that it’s one time where Microsoft could have (and probably should have) come up with a substantially better error message or provided some sort of Knowledge Base article on the topic. As far as I know, there isn’t any such article and developers are currently having to rely on community support to fix this problem. It isn’t the first time Microsoft has left developers wondering. If you ever encounter this sort of problem, please let me know about it. If I can confirm the issue, I’ll put together a blog entry about it to get the word out to others in order to save them a bit of time.

 

Choosing the Right Express Edition Version

A lot of my readers rely on the Visual Studio Express Edition products to follow the examples in my book with good reason—the product is a free download. Books like Start Here! Learn Microsoft Visual C# 2010 Programming are actually designed from the ground up to use Visual Studio Express Edition. Even though I wrote Professional Windows 7 Development Guide with the purchased product in mind, most of the examples work just fine with the Express Edition as well. It makes sense to me that you’d want to try to learn as much as possible without making a huge commitment in software, so I welcome hearing about your Express Edition experiences.

The latest issue I’m encountering with readers is that Microsoft has changed how the Express Edition downloads work for Visual Studio 2012. There are now several versions of the Express Edition and you have to be sure you download the correct version to ensure that the IDE works with your operating system and my books. Make sure you download Express for Windows Desktop, not Express for Windows 8 (which doesn’t install on anything but Windows 8). The Express for Windows Desktop works with the following operating systems.

 

  • Windows 7 SP1 (x86 and x64)
  • Windows 8 (x86 and x64)
  • Windows Server 2008 R2 SP1 (x64)
  • Windows Server 2012 (x64)

 

This version of the Express Edition will let you create a number of application types. For example, you can create these sorts of applications:

 

  • Windows Presentation Foundation (WPF)
  • Windows Forms (WinForms)
  • Win32


Notice that there is no Metro support included with this version. None of my books currently support Metro either. However, if you decide you want to create a Metro application, then you need to download the Express for Windows 8 version and you must install it on a Windows 8 system to use it. Even though the downloads may look confusing, the differences between them are really straightforward.

Make sure you meet all of the requirements for install Visual Studio 2012 on your machine. The Express for Windows Desktop version has these requirements:

 

  • 1.6 GHz or faster processor
  • 1 GB of RAM (or 1.5 GB when running on a virtual machine)
  • 5 GB of available hard disk space
  • 100 MB of available hard disk space
  • 5400 RPM hard disk drive
  • DirectX 9-capable video card running at 1024 x 768 or higher display resolution


Don’t get the idea that my books require Visual Studio 2012. All of my existing books work just fine with the Visual Studio 2010 Express Edition. This version works on older versions of Windows and has smaller system requirements. Of course, Microsoft will remove this product from its site at some point, so if you want to use this older version, make sure you download it now.

Let me know if you encounter any additional difficulties using the Visual Studio 2012 Express for Windows Desktop with my books at John@JohnMuellerBooks.com. In the meantime, happy coding!

 

Duplicating Hotkeys in a User Interface

A developer can experience a number of odd rules when working through an application design, especially when it comes to accessibility. The two main reasons to provide a hotkey within an application are to make the application more accessible for users who have a hard time using a mouse and to make it more efficient to use for keyboardists. Pressing Alt+Q to quit an application is often easier for these users than clicking the associated button with a mouse. Both actions accomplish the same goal, but using different approaches.

To create a hotkey in most languages, a developer simply adds an ampersand (&) in front of the hotkey character for a control’s caption (text) or its associated label (as in the case of a text box). For example, a caption of &Quit on a button will create a hotkey of Q and the user would press Alt+Q to perform the default action with that button without using the mouse or by tabbing between controls. Modern version of Windows show the hotkeys as underlined letters when the user presses Alt. (Older versions of Windows showed the hotkeys underlined at all times.)

A reader recently pointed out that there is a technical error in my book, “Start Here! Learn Microsoft Visual C# 2010 Programming.” The Array project that begins on page 90 shows two buttons that use the Q hotkey in Table 4-1 on page 92, LINQ and Quit. When it comes to buttons, every button must have a unique hotkey. That’s because using the hotkey doesn’t select the button—it performs a task. Pressing Alt+Q in the example as written will either perform the task provided by the LINQ button or quit the application (the action provided by the Quit button). To correct this problem, you need to specify the LINQ button use the N hotkey instead by changing the Text property from LIN&Q to LI&NQ. Pressing Alt+N will now execute the task performed by the LINQ button.

However, there is a little rule oddity that you need to know about hotkeys when designing applications. While you can’t duplicate the hotkey used for a button, you can duplicate the hotkey for fields. That’s because the hotkey selects the field. When the user presses the hotkey combination a second time, the next field that relies on the hotkey is selected. If there is a third field with the same hotkey, pressing the hotkey combination a third time will select that field. The fields are selected in order until they have all been selected, and then pressing the hotkey again will select the first field. Consequently, when you have an abundance of fields on a form and a lack of usable hotkeys, duplication becomes an option.

Remember that duplication only works with selections. For example, the label associated with a text box can contain a hotkey. Pressing the hotkey combination defined by the label will select the text box. The same can be said of checkboxes, listboxes, comboboxes, and any other field-type control you can image as long as the default action for that control is selection, rather than performing a task as a button would.

I don’t often make accessibility errors in my applications because it’s a big deal to me to make my applications as friendly and accessible as possible. However, it happens even with me, which points out the need to have other people test your code strenuously; looking for this very sort of problem. Normally, you don’t want to duplicate hotkeys, but when you must use duplicate hotkeys due to the number of controls on a form, use duplication only with controls that select a field. Let me know if you have any questions or comments at John@JohnMuellerBooks.com.

 

Using Appropriate Application Testers

It doesn’t matter what sort of application you’re creating—every application requires testing by an appropriate audience. Even VBA applications, such as those described in VBA for Dummies, require testing. I wrote about this topic in C# Design and Development, but it applies to all developers equally. The application stakeholders need to be involved in every phase of application development, but most especially in the testing phase. You may obtain stellar results when testing your application using a select group of users, but the real world is much harsher. Users come in all shapes and sizes and your application must accommodate them all.

One of the most critical groups to include in your testing environment are those with special needs. I wrote about this group in Accessibility for Everybody: Understanding the Section 508 Accessibility Requirements. It’s important to understand that our aging population makes testing for this group critical. I think that Microsoft’s statistics are low, but you can read about how Microsoft has improved the accessibility features in Windows 8 in Enabling Accessibility to accommodate all groups, especially the elderly. However, you also need to include less skilled users, those with a lot of skills, but little computer knowledge, and those who are quite technically savvy, but want to get their work done quickly. In short, your stakeholders should include someone from each group of users in your organization. (The smart development team creates a list of these groups before the application is underway in order to start obtaining input from them as early as possible.)

Someone recently wrote me to say that he applauds my efforts to encourage developers to write better applications. The reader went on to say that I didn’t have any idea of just how hard the real world could be though and that actually implementing even a subset of my ideas would be incredibly hard. In short, the idea of accommodating everyone who will use an application is simply not possible in today’s environment. The problem with this attitude is that not accommodating user needs actually ends up costing an organization more in the long run.

It’s essential to understand that applications can be well-written and yet not serve the needs of the people using them. You can create a fabulous application that no one uses quite easily. When I say that testing must involved appropriate application testers, it means that these testers must represent all groups who will actually use the application and that you must accept all sorts of input from these users. The input may require that you rework the user interface or that you fix certain bugs. In some cases, you may even need to remove features because the stakeholders will never use it and the feature simply ends up confusing everyone. Applications that don’t address the needs of the users will cost your organization time and money in the following ways.

 

  • Users have a choice about applications today and they will simply ignore your application to use something that meets their needs better.
  • Whenever users become confused, they call support, which ends up costing your company both time and money.
  • Support calls take time and your user isn’t being productive while talking with support.
  • Even when the user is able to use the application, the accumulation of errors tends to slow the user down and increase the time required to perform a task.
  • Confused users tend to try combinations of things in frustration, which often results in data loss and other unfortunate consequences.


Part of the problem with the corporate atmosphere today is that management applies considerable pressure to get an application in production as quickly as possible. A developer can become quite tempted to use a group of “yes man” testers to show management that the application is ready for use, when it really isn’t even close. The theory is that it’s much easier to ask forgiveness for a poor design later, than to ask for additional time today. However, savvy developers know that it’s easier to change an application design than to apply fixes to an application that’s already hosted on a production system. The bottom line is that you always need to test with the appropriate group and create an application that really will do the job.

What are your worst experiences with application testing environments? How do you choose the testers you rely on to check your applications? Let me know at John@JohnMuellerBooks.com.