Posts Tagged reader

Fluent C# Review : Chapter Three

I am reviewing an advanced copy of the book Fluent C# by noted .NET author Rebecca Riordan.

My focus today will be on chapter three. Chapter three picks up where chapter two left off  in describing the Visual Studio environment. It does an excellent job of reviewing the more intricate details of Visual Studio. Again, it ignores winforms and focuses on the Windows Presentation Foundation (WPF) forms and design editor. Encouraging the reader to customize the interface for themselves, it shows how to do that. I certainly have not seen that done before so early on in the process and in such an easygoing manner. It ends the first section explaining what Intellisense is. Later on in this chapter it goes into how members are listed. An excellent tutorial on refactoring and such is also discussed. It’s possible this discussion could have waited a bit until later on but it still works here.

We then move on to cover what a Visual Studio solution and project is and what it contains including a very helpful diagram, as they seem to always do in this book, explaining what the relationship between the various items in a Visual Studio solution and project are.

image

The next section introduces designer and source files, resources and your design documents. Covering how to add items to a solution or project comes next along with a graphical and step by step process of how to modify project properties. Changing the icon and window property is one such example they cover. Then we build the application to see the results of the changes.

Further customization of the Visual Studio environment is then discussed in the usual graphical and step by step nature this book is so good at.

image

Overall I wish I had had a book like this when I first started using Visual Studio so many eons ago!

The next chapter gets into debugging and deploying an application. Moving right along the user shouldn’t be overwhelmed with this patient, easy going manner of teaching.

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a comment

Fluent C# Review : Chapter One

I am reviewing an advanced copy of the book Fluent C# by noted .NET author Rebecca Riordan.

My focus today will be on Chapter One. Chapter One opens with an introduction to what application development is. It takes the reader through the simple problem of a messy paper stack and through a picture flow chart attempts to show the reader how the problem is to be solved and equate it with the same process of writing a windows application. It is unlike anything you have ever seen in a development book! But it is also one of the most clear renderings of the application process that I have seen.

image

They introduce you to the “clients” that are to appear throughout the book, two cooks named Neil and Gordon. (Incidentally the editor happens to be named Neil….coincidence? I think not!). It encourages you to take breaks at certain strategic points throughout the book as well. Neil and Gordon hand out their requirements and Riordan helps you get through it. She even begins the process of explaining the Agile software development methodology. It then introduces UML (Unified Modeling Language) and why it should be used. That and Agile are actually advanced topics perhaps left to a later time but I get why they do it here.

In the first project the book attempts to take you down the path of creating your requirements but before you see a single line of code you see the requirements explained in an easy to understand real life example. Then before you know it you have been introduced to database schemas, class diagrams and screen layout concepts all really done in a beautifully illustrated way. Extremely well done!

When there are words that need to be defined they are set out like so, so that they stand out from the rest of the page (see example below). Again hard to miss and it really catches the eye.

image

It goes into JIT (Just in Time Debugging) and the CLR (common language runtime) explaining what it is and how it is used. Of course at the end there is the obligatory review of the chapter. The only difference is this one is beautifully illustrated.

I don’t know about you but I am certainly looking forward to chapter two as we get more into the nuts and bolts of what is happening.

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

Leave a comment

Check if SQL Database Exists with C#

Good Morning! I wanted to give a shout out to another blogger who linked to us yesterday here. It was so nice of him you know? Just amazing, the generosity of some folks out there!

Today’s code was a rewrite of the vb.net code here but using C#. One thing of note is that the Using keyword has a completely different meaning in C# so thus has been removed. It wasn’t really needed anyway.

Anyway, so make it a great day!

public Boolean testDatabaseExists(string server, string database)
        {
            String connString = (“Data Source=” + (server + “;Initial Catalog=master;Integrated Security=True;”));
            String cmdText = (“select * from master.dbo.sysdatabases where name=\'” + (database + “\'”));
            Boolean bRet;

            System.Data.SqlClient.SqlConnection sqlConnection = new System.Data.SqlClient.SqlConnection(connString);
            System.Data.SqlClient.SqlCommand sqlCmd = new System.Data.SqlClient.SqlCommand(cmdText, sqlConnection);
           
            try
            {
            sqlConnection.Open();
            System.Data.SqlClient.SqlDataReader reader = sqlCmd.ExecuteReader();
            bRet = reader.HasRows;
            sqlConnection.Close();
            }
            catch (Exception e)
            {
            bRet = false;
            sqlConnection.Close();
            MessageBox.Show(e.Message);
            return false;
            } //End Try Catch Block
                      
           
            if (bRet == true)
            {
                MessageBox.Show(“DATABASE EXISTS”);
                return true;
            }
            else
            {
                MessageBox.Show(“DATABASE DOES NOT EXIST”);
                return false;
            } //END OF IF

           
        } //END FUNCTION

Facebook

, , , , , , , , , , , , , , , , , , , , , , , , , , , , , , ,

6 Comments