Accessing Sample Database Data (Part 4)

The previous post, Accessing Sample Database Data (Part 3), discussed the need to change the connection string for a database in the App.CONFIG file. However, you haven’t actually gained access to the database as of yet. Depending on how the book is written, you may have to create the database using code and manually inputting the entries, run a script, or add a database file to SQL Server. Of the three, writing the database code and manually inputting the entries is the most straightforward. All you need to do is perform the instructions written in the book. As mentioned in my first post, many readers find this method the least acceptable because database management tasks of this sort are supposedly in the realm of DBAs.

In order to work with databases in Visual Studio, you must have a connection to the database. All of my books show how to create such a connection using Server Explorer. The project will not include a connection when you open the downloadable source code. The connection to the server is part of your Visual Studio setup and you must create it when you begin working with the downloadable source. The short take on creating a connection is to right click the Data Connections folder in Server Explorer and choose Add Connection from the context menu. You’ll see a wizard that will lead you through the steps for creating the connection.

Using Scripts

The next level of complexity is the script. A number of my books use scripts in order to make it at least reasonable to use something other than SQL Server as the database manager. More and more of my readers want to use other solutions. Accommodating this need is proving difficult, but using scripts does have the advantage of reducing the work required to use non-SQL Server solutions. I’m going to assume that you’re working with Visual Studio and that you have a connection to your database manager, whatever that database manager might be. The following steps tell how to use scripts in a general way (you may find slight variations in the steps between different versions of Visual Studio).

  1. Choose File | Open | File. You see an Open File dialog box.
  2. Highlight the script you want to use (a script always has a .SQL extension) and click Open. You see the script opened in Visual Studio.
  3. Right click anywhere in the editor window and choose Execute SQL from the context menu. Visual Studio interacts with your database manager to run the script.

Using a Database File

The third level of complexity is actually using a database file. The advantage of using this option is that the database is completely configured and contains everything needed to use it. This level represents the least amount of work on the part of the reader in most cases. It’s also the least flexible because it only works with SQL Server and the version of SQL Server must be able to support the features in the database file. Use these steps to work with a SQL Server database file from Visual Studio.

  1. Open Server Explorer by choosing View | Server Explorer. You see the Server Explorer window open as shown here.
    AccessDataPart4_01
  2. Right click Data Connections and choose Add Connection from the context menu. You see the Choose Data Source dialog box shown here.
    AccessDataPart4_02
  3. Select Microsoft SQL Server Database File. The wizard automatically chooses the correct Data Provider option for you. Click Continue. You see the Add Connection dialog box shown here.
    AccessDataPart4_03
  4. Click Browse. You see the Select SQL Server Database File dialog box shown here.
    AccessDataPart4_04
  5. Highlight the file you want to use and click Open. You return to the Add Connection dialog box.
  6. Click Test Connection. You should see a success message. If your version of SQL Server doesn’t support the features needed to use the database file, you’ll see an error message that states the file can’t be downgraded. The message will also tell you which version of SQL Server you require to use the database file.
  7. Click OK. Visual Studio creates the connection for you. What has actually happened in the background is that SQL Server has created the connection at the request of Visual Studio.

Summary

I try to choose the database option for my books with care. Many of my books use more  than one option to allow more people to work with the option that best suits their needs. However, it’s impossible to please everyone with the choices I make. When you encounter problems using one of the database options I’ve selected, I’ll try my best to help you work through the difficulties. As with every other aspect of my books, working with the databases is a learning experience. Let me know your thoughts on database access in my books or if you have additional database access questions at John@JohnMuellerBooks.com.

 

Get Ready…Get Set…Garden! 2013

This year’s trip to Baraboo for Get Ready…Get Set…Garden! is part of our continuing education. I talked about this particular educational opportunity in last year’s Get Ready…Get Set…Garden! post. The sessions are hosted by the Sauk County UW Extension, which actually puts on a substantial number of events during the year. Our itinerary for this year consisted of container bag gardening techniques, growing small fruits (strawberries, raspberries, and blueberries), and gardening with aches and pains (essentially a session on dealing with accessibility needs for gardeners).

The first session discussed container bag gardening and the advantages it offers over using buckets or over-sized pots to hold your garden on the patio. Every year Rebecca puts together a wonderful salad garden for me. Of special interest are the cherry and salad tomatoes. If I need a snack, I simply go outside, enjoy the flower garden she has put together for me, and munch a few tomatoes—nothing could be better than that. However, we had always wondered whether there might be something more that we could do. This year’s sessions shows that we can. However, instead of using the really expensive gardening bags that the instructor promoted as part of her business, we plan to use feed sacks. They’ll perform the same function and only cost a fraction of the amount (a bag large enough to grow tomatoes costs $22.00 if you go the garden bag route, the same size feed bag is free since we get them as part of buying feed for our animals).  I’ll post again sometime later this year to let you know how the garden bags work.

We have also had a lot of problems growing blueberries, despite ensuring the ground is acid enough for them. It turns out that we have been doing a few things wrong—the most important of which is that we haven’t been watering our blueberries enough. It seems that they require almost boggy conditions to grow acceptably. Equipped with our new knowledge, we’re going to give blueberries another try this summer. One of the problems with gardening is that you aren’t likely to get the technique right on the first try, or the second, or the third. There are some people who think gardening is science. Well, that’s partially correct, but it’s also part art. Sometimes you just need to feel your way through a growing experience.

Unfortunately, our instructor didn’t arrive for the third session. Someone with the UW Extension did fill in, but I can’t help but feel a bit disappointed because I was really looking forward to getting quite a lot out of this third class. As Rebecca and I get older, it would be nice to know about a few of the things we could do to make our gardening experience better. Even so, I must applaud the UW Extension instructor for getting up and giving an impromptu discussion on a topic that she hadn’t prepared for without any preparation time. To simply get up and start talking would be one thing—to do it exceptionally well given the circumstances is nothing short of amazing. I also plan to post again on some thoughts I garnered on meeting accessibility requirements for gardening.

There are some benighted people who think that education ends when you leave high school or college. Education is a lifelong endeavor. Gaining new knowledge and then turning it into wisdom adds spice and keeps our minds fit. Whether your intellectual love is technical, natural, or in some other realm, take time to embrace it by furthering your education. Let me know your thoughts on continuing education at John@JohnMuellerBooks.com.

 

Discovering a New Way to Create JavaScript

Over time, developers will gain an entire toolbox full of different computer languages. A fully stocked toolbox is a developer’s best defense against the ever changing tide in what’s popular and what’s not in the world of application development. Recently I learned about a new computer language called TypeScript. The amazing thing about TypeScript is that it’s a true superset of JavaScript. If you know how to write JavaScript, you already know a great deal about TypeScript. In fact, I wrote an article entitled, “TypeScript: A New Direction in Browser-Based Applications” that describes some of my experiences with this new language. The short story is that TypeScript compiles into JavaScript, so you start with TypeScript and its advantages and end up with JavaScript code that is ready for use in your favorite Web application.

Of course, the biggest question people ask me is why I need to know yet another language.  After 28 years I’ve collected knowledge of more than a few computer languages—some of which turned out to be turkeys, some of which were extremely useful for a limited time, and others that I still use almost daily. Experiencing new languages and understanding how they can make developers more productive helps keep computer science alive for me. If I had stayed with the original set of languages that I learned as part of my training in college, I would not only be bored to tears, I’d be unemployed. So, if nothing else, learning about TypeScript is an adventure for me.

Adventures are better when they’re productive and interesting. TypeScript is interesting because it actually does improve on a language that’s really popular. You gain the advantages of using a compiler and static typing (amongst other things). For me, the use of the compiler is the biggest advantage because working with a compiler makes it possible to locate and fix the sort of simple errors developers make when tired. There have been more than a few times where a seemingly simple problem has kept my JavaScript application from running as it should and I later found that the problem was something that a compiler would have found in an instant.

Finding mistakes fast and easily, especially when you’re tired, is a real productivity booster. If I can code efficiently for another hour or two because I have a compiler helping me, I can produce more usable code than other developers. In the end, no one is going to care that I used a compiler to produce my JavaScript code. All that anyone is going to care about is that I produced more lines of code in a given time-frame than other developers using older techniques that don’t involve using a compiler. When you use TypeScript, you gain a productivity advantage over other developers.

TypeScript is available using the Node.js Package Manager, a Visual Studio plug-in, or by compiling the source code for your particular environment. My personal favorite is the Node.js Package Manager because it lets me work at the command prompt without having to worry about a particular IDE. I simply set up Komodo Edit to work with the new environment. Since I already use Komodo Edit to create my JavaScript applications, the environment is a good fit with TypeScript as well. There is no actual TypeScript support in Komodo Edit now, but people are talking about it. Of course, you’ll have your favorite environment and working with a new language like this always presents some challenges at first.

If you do try TypeScript out, let me know what you think of it. Do the features that TypeScript provides today make working with a new language worthwhile? Let me know your thoughts at John@JohnMuellerBooks.com. Also, keep your eyes peeled for more posts about TypeScript because this really does seem like an interesting and productive language!

 

Accessing Sample Database Data (Part 3)

The previous installment of this series, Accessing Sample Database Data (Part 2), discussed the Windows-specific setup required to use your database from Visual Studio. It includes setting the file for read/write usage and also verifying that you have permission to work with the files. This part of the series will discuss one of the most important settings within Visual Studio itself, the connection string. In order to use a data source from within a Visual Studio application, you must tell Visual Studio where to find the data source—a sensible requirement when you think about it.

The problem for me as an author who is trying to provide you with downloadable source code is that I have no idea of what SQL Server configuration you plan to use on your system. I can make some educated guesses, but that’s about it. So, there is every chance that the connection string is going to be wrong when it comes to the actual location of the data source on your system; especially when you use a different setup from the one in the book.

In most cases, you’re most interested in locating a string similar to data source=.\SQLEXPRESS in your application. This string normally appears in the App.Config file. Over the years I have tried a number of permutations of this string, but none work out quite so well as .\SQLEXPRESS. The period represents the local machine, but you can replace it with any machine name desired. For example, if you use a separate server named WinServer, you’d use WinServer\SQLEXPRESS instead of .\SQLEXPRESS.

The SQLEXPRESS part of the data source attribute is also dependent on your setup. When you install SQL Express on your system, it usually installs as a named instance called SQLEXPRESS. However, you could just as easily install it as the default instance or you might not use SQL Express at all. To specify that you want to use the default instance of SQL Server, you use a period (.). So the default instance on the local machine would appear as .\.. Otherwise, you must provide the name of a named instance of SQL Server to use.

There is always a question of whether you have found every instance of the data source string in your application. Newer versions of Visual Studio place the string in one location when you create a connection using a wizard, App.Config. However, depending on how the application is put together, you could conceivably find the string in other locations. To ferret out these other locations, use the FindStr utility at the command line. I describe how to use this utility to locate errors in your application code in the Using the FindStr Utility to Locate Errors in Visual Studio post. You can use precisely the same approach for locating the data source. In this case, you’d open a command prompt at the main folder for the downloadable source, type FindStr \m \s “\SQLEXPRESS” *.*, and press Enter. FindStr will locate all instances of that particular data source.

In order to change the example code so that it works with your system, you must modify the data source string wherever it appears in the sample code to match your particular system. Let me know if you encounter problems making this change at John@JohnMuellerBooks.com. You can see the next post in this series at Accessing Sample Database Data (Part 4).

 

Review of Darby O’Gill and the Little People

This past weekend we had a good time celebrating St. Patrick’s Day. We aren’t Catholic or Irish, but getting caught up in a celebratory event of this sort is fun despite the fact we don’t participate fully. Of course, we had to have corned beef and cabbage for dinner on Sunday. Rebecca adds a few items of her own including carrots, onions, potatoes, and (interestingly enough) parsnips. Corned bread completes the dinner in most cases, but this year we decided to have some of her delicious homemade bread instead.

Part of our celebration has always involves watching Darby O’Gill and the Little People. Yes, the movie came out in 1959, so many people will likely think that it’s had its day and no one should really bother with it anymore. However, this is a G rated movie that really is quite a lot of fun and it has some amazing special effects considering when it was made. The part I like best about this movie is that it can have a lot of fun without an overpowering script or any of the other baggage that seems necessary in movies today. Some movies are meant solely to entertain and this is one of them. There truly isn’t anything to think about—just enjoy the ride.

The movie takes place in old Ireland. Of course, there is a lord of the manor and Darby works for him. Even though the movie doesn’t apparently have any sort of specific time in mind, people are still moving around by horseback and butter is churned, not purchased at a store. The tavern is a place for exchanging the gossip of the day and it isn’t unusual to find the priest there enjoying a glass of stout. It’s a carefree sort of a movie and I’m sure that the scenery is a caricature of Ireland, rather than the real thing. It presents a idyllic scene of what we think things might have been like.

Don’t get the idea that the movie is lacking in the plot area though. This movie does have an interesting plot that includes dealings with the leprechauns, of course. (These leprechauns are a fun sort, not the dark sort found in some other movies.) There is a certain amount of drama, part of which includes a lost girl and a dark, stormy night. One of the action scenes shows two young bucks fighting over the same girl. Perhaps some of the ideas are a bit clichéd, but they’re done in a way that doesn’t make them feel old or tired.

The movie does include some scenes where it is obvious that people are drinking. In fact, there are drunken people in a few places. The drinking and drunks are portrayed in a way that a few people will find unappealing today (remember that the movie was made in 1959 and attitudes were different at that time). If you really want to keep your kids away from all mention of alcohol, this is probably one movie to skip. Otherwise, you can probably discuss the matter afterward and leave things go at that. I doubt very much that most children will even notice the drunken adults as being drunken.

Overall, Darby O’Gill is the right sort of movie to watch on St. Patrick’s Day, whether you’re Irish or not. It’s a lot of fun and the good guys win, of course. What’s not quite so obvious at times is who is good and who is not. You only truly find out the details at the end of the movie.

 

The Entity Framework and Visual Studio 2012 Update 1

It’s common practice for me to wait a day or two and then look for potential problems with an update before I install it. I don’t have a fleet of machines with which to test updates and an errant update could put me out of business until I can correct it. I let Visual Studio 2012 Update 1 languish for a while because I’m in the midst of a book project with it (Entity Framework Development Step by Step) and wanted to wait until I reached a point where the update wouldn’t affect my scheduled writing time. A cursory look online didn’t point out any problems with the update. However, after installing Update 1 I suddenly began receiving this message every time I tried to perform an update of my Entity Framework model:

A processor named ‘T4VSHost’ could not be found for the directive named ‘CleanupBehavior’.

The odd thing is that I had tried a number of other tasks and completed them without problem with the update in place. So, this issue took me by surprise. Even more interesting is that there doesn’t seem to be a major outpouring of angst online about the issue—leading me to believe that many developers are only now moving to Visual Studio 2012. I did find a Microsoft Connect discussion about the issue, which includes feedback from Microsoft about the problem. This problem apparently first appeared as part of the Community Technical Preview (CTP) release. It appeared to be fixed during that release, so Microsoft closed the error. However, look down the list of comments and you see that on 3/5/2013 Microsoft reopened the issue.

The Microsoft Connect discussion also presents two workarounds—neither of which worked for me. I finally ended up uninstalling my copy of Visual Studio 2012 completely, ensuring that the directory and everything else associated with Visual Studio 2012 that I could find were removed from the system, and reinstalling Visual Studio 2012 sans Update 1 to get my system back into an operational state.

The bottom line is that I can’t recommend installing Update 1 if you plan to work with the Entity Framework using Visual Studio 2012. In fact, it may be a good idea if you hold off installing Update 1 until Microsoft has more time to work out the kinks. Don’t get me wrong. Installing updates is an important part of keeping your system running well and keeping the crackers at bay, but this is one time where the update fails to live up to its promise. Let me know whether you’ve experienced this particular issue at John@JohnMuellerBooks.com.

 

Accessing Sample Database Data (Part 2)

In my previous post, Accessing Sample Database Data (Part 1), you learned about the various ways in which an author can provide database examples as part of a learning experience. This post is going to look at the process for gaining access to the database files in Windows, no matter what sort of database is used (including XML databases). In order to perform the tasks in this post, you need a copy of Windows Explorer opened with Administrator privileges. Choose Start | All Programs | Accessories to see the Windows Explorer shortcut. Right click the Windows Explorer shortcut and choose Run As Administrator from the context menu. Provide the requires credentials (username and password) to run in administrator mode, if asked.

Checking File Access

Some of the databases you obtain for my books appear on a CD or other device that provides read-only access. When you copy the files from the CD or other device to your hard drive, Windows keeps the files set to read-only access. In order to use the files, you must be able to read and write them. To change this setting, right click the folder that holds the files and choose Properties from the context menu. You see a properties dialog box similar to the one shown here.

AccessDataPart2_01

Clear the Read-only checkbox and click OK. You’ll see a Confirm Attribute Changes dialog box like the one shown here.

AccessDataPart2_02

Make sure the Apply Changes to this Folder, Subfolders and Files options is selected. Click OK. Windows will make all of the files read/write so that you can work with them. If you see a User Account Control (UAC) dialog box telling you that Administrator permission is required, click Continue and provide the required credentials (username and password) if required.

Checking Folder Security

It’s essential that you check folder security to avoid all sorts of weird problems that arise when you don’t have access. Never assume you actually have access; always check it to be sure. Right click the folder holding the files and choose Properties. You see the Properties dialog box again. This time select the Security tab as shown here.

AccessDataPart2_03

Make sure that your account, or a group account to which you belong, is listed in the Group or User Names list as having Full Control (as shown in the Permissions list in the bottom half of the dialog box). If you don’t have the required access, click Edit. You’ll see a Permissions dialog box for the affected folder as shown here.

AccessDataPart2_04

Verify that your name or a group of which you are a part appears in the Group or User Names list. If not, click Add. You’ll see a Select Users or Groups dialog box like the one shown here.

AccessDataPart2_05

Type your login name or the name of the group that should have access to the folder. Click Check Names to ensure you typed the name correctly. If you didn’t type the name correctly, Windows will tell you it didn’t find the name and provide you with another dialog box for searching for the correct name. Otherwise, you’ll see the fully qualified name used to access the folder. Once you have a correct name in place, click OK. You’ll see the Permissions dialog box again.

Select the name you want to use to access the folder from the list. Check the Full Control option in the Allow column of the Permissions list at the lower half of the Permissions dialog box. Click OK. If everything goes correctly, you’ll see the Security tab of the Properties dialog box again, but this time it will contain your selected group with full control access.

Something odd can happen and it confuses a lot of readers. You might see a dialog box similar to this one during the security setting process:

AccessDataPart2_06

When you see this dialog box, it usually means that the SQL Server service is running and it has the requested file open. Click Continue for each of the disallowed changes to ensure that your folder remains in a usable state.

Now, open the Services console found in the Administrative Tools folder of the Control Panel. Locate the SQL Server service and click the Stop link on the left side of the right pane to stop the service as shown here.

AccessDataPart2_07

Try setting the security again. If the error persists, you need to try to set the security on the individual database files using the same technique you tried to use for the folder as a whole. (When working with individual files, the security tab may display a message saying you need administrative privileges to view the individual file security. Simply click Continue to work with the privileges.) Yes, it’s a nuisance setting individual file security, but that’s the way Windows works at times. After you successfully set security on each of the database files, remember to restart the services that you stopped.

A number of readers stumble on these file access and security permission issues. Please let me know if this post solves the problems for you. If not, make sure you send your questions to John@JohnMuellerBooks.com. You see see the next post in this series at Accessing Sample Database Data (Part 3).

 

Accessing Sample Database Data (Part 1)

It’s always hard to figure out the best way to provide access to sample data in a book. No matter how you do it, someone is going to find the amount of data limited or unrealistic, too hard to understand, too hard to access, or too hard to install.

One of the most common ways to provide sample data is to use a predefined database, such as Northwind or the newer AdventureWorks, that the reader can download and install. However, there are several problems with using these databases. For one thing, installing Northwind requires running a script that may not succeed (and then I get questions about why my script failed—unfortunately, it isn’t my script, it’s Microsoft’s script). Using AdventureWorks requires a copy of the SQL Server tools because you install the actual database and the tools don’t come with Visual Studio’s copy of SQL Server Express any longer, so now I also need to tell the reader how to install the required tools. In both cases, many readers find the process of working with these predefined databases too complicated. Once the databases are installed, many readers find the database design unrealistic and overly complicated (especially in the case of AdventureWorks, which really is complex). In addition, as more of my books move toward the open source realm, I can’t assume the reader will even have a copy of SQL Server. (If someone has a suggestion for a great open source alternative, please let me know.)

Another technique is to create a predefined database that I supply with the book’s downloadable code and ask the reader to install it as necessary. When working with a book that uses SQL Server, this means including the actual database file or creating a script to reproduce it. Again, the reader would need to install these files in some way—either by running the script or installing the database file using the SQL Server tools. When writing open source books, I’m leaning toward using XML databases because they’re text-based, simple to work with, and work on any platform. At least XML databases don’t require installation or scripts because they appear in the same folder as the application does. Because these databases specifically model the book environment, readers don’t complain about complexity or applicability, but some readers complain that they also don’t model their environment very well.

Of course, there is always the approach that I take in some books of having the reader build the database as part of the learning experience and then typing the data into it. The amount of data is small in most cases, so it’s not as if the reader is working for hours to input the information. However, this solution garners criticism because it’s too simplistic (doesn’t model the real world well enough) and readers feel that it’s more important to see working code, rather than work with the database. After all, database design is an entirely different specialty (some developers will be surprised when their employer asks them to create databases as part of their job). There is also that constant problem with the availability of tools—many of which are solved with Server Explorer when working with Visual Studio, but again, many of my projects are moving more toward open source.

In an effort to address the complaint about not spending enough time in the IDE and in creating code, there is always the approach of having the reader build an application that creates the database and fills it with data. The complaint this time is that most readers will never build such an application (I disagree because such applications are used all the time for storing settings and other application-specific information). What the reader really wants to see is the code that manipulates the database data and lots of it (sometimes without the level of explanation that less experienced readers require to actually understand the example). It’s important that I address all reader needs with the examples I create, so you’ll continue to see examples that create the database and fill it with data. The examples will always include full explanations so that no one is left behind. However, I am providing more references to online examples that emphasize code, lots of it, over any sort of explanation.

The point is that there are a number of ways in which an author can attempt to satisfy reader needs when writing a book that contains database management techniques. To make the book useful, the reader must have a database of some sort to work with. Whether the database is XML-based, SQL Server-based, or some new type of data source isn’t the problem for the most part—it’s creating a database that works well with the book’s material, models a real world environment to some degree, and is still easy enough to understand that the reader doesn’t become lost in detail. In order to accomplish these goals, more of my books now employ multiple database scenarios so that each reader type has enough data of the right type to get the maximum possible benefit from the book examples.

Of course, undertaking such a gargantuan task isn’t easy. Every one of you seems to have an entirely different set of needs. The next post in this series is going to attempt to demystify the process of getting the databases installed when working with SQL Server and Visual Studio. I also include instructions in my books, but this additional information is based on feedback from less experienced readers who are having trouble gaining access to the databases. What I’d like is to hear your questions so that I can address them in future posts. If you’ve had a problem getting one of my database examples to work because you can’t access the data, please let me know at John@JohnMuellerBooks.com. You can find the next post in this series at Accessing Sample Database Data (Part 2).

 

Using a Bleach Substitute

I have become a label commando in recent years. People actually become quite disturbed waiting for me to finish my latest epic reading of a cleaning product or food label. I read everything, including the list of ingredients when I can find one. More importantly, I look for what’s missing on the label. For example, I’m surprised at how many margarine labels refuse to tell me that they don’t contain any cholesterol. Lest you think this is one of those odd fetish requirements—some fish oil tablets actually contain cholesterol. We pay the extra to buy a product that’s labeled cholesterol free (and yes, it does make a difference when the doctor tests your cholesterol).

So I was taken by surprise recently when I read a bleach label. The stuff should be labeled toxic waste and left go at that. The label told me about the dire consequences of using the product, such as permanent damage to my esophagus. Bleach is also a terrible product to use in a house with a septic system because it kills off all of the helpful bacteria in the septic tank and causes the waste to just sit there (possibly flooding your house with a really smelly mess). However, the part about not putting the empty container in the trash or in the recycle bin is what got me most. Just where was I supposed to dispose of the container? It turns out that you’re supposed to take it to a hazardous waste disposal site. A product labeled hazardous waste has no place in my house. (Just consider the fact that many of the foods you buy in the store have been soaked in bleach and you don’t have to think very long about why your food is making you sick.)

Of course, country homes require some means of keeping things clean and getting rid of bacteria, just like anyone else does. It turns out that there is a really good solution and it actually works better than bleach. Most importantly, this solution is pretty much harmless to everyone and everything. You fill up two bottles: one with vinegar and another with hydrogen peroxide. Spray a surface first with the vinegar and second with the hydrogen peroxide and you create a really effective cleaning agent called peracetic acid. The point is to keep the two components separate until you actually need to use them in order to gain a highly effective cleaner that’s a whole lot less harmful than bleach.

What impressed me most is that the combination actually works well on carpets as a stain remover. It’s also much more effective than bleach at getting bathroom grout clean and it works especially well on surfaces with small crevices. Some people do mix the two and add water for use in laundry, but keeping the two chemicals separate is the best way to avoid the potentially toxic qualities of the peracetic acid. As with any cleaner, you do want to use this one with care, but it’s frankly a lot better than using bleach. Let me know your thoughts about this interesting cleaning aid at John@JohnMuellerBooks.com.

 

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.