Category Archives: Articles

Getting Started in Software Development: Part III – Programming Technologies

So far, I’ve given you some general ideas of what it takes to start and maintain a career in software development but you’re probably still wanting some direction as to the actual first steps of learning how to program. In this chapter, I’ll give you a sampling of the options available. Pay close attention to the links sprinkled throughout for additional information.

There are a lot of options out there because there are a lot of different computer languages and types of devices to program. The type of device for which you’re creating an application and the operating system it uses is sometimes called the platform. For example, if you’re programming Windows applications for the PC, then you’d be writing for the Windows platform. The Android OS that powers smartphones and tablets would be a separate platform and would require different programming tools. Some people might get confused by the term platform so it’s easiest just to say “I write Windows programs.” or “I create websites.”. You’ll find that one of the challenges of a programming career is communicating ideas to non-programmers.

Continue reading

Getting Started in Software Development: Part II – Finding a Career

You’ve probably heard people talk about how we’re living in the Information Age with an emphasis on how much information there is to process from all different directions. This is certainly true and it can be a challenge for the average person, especially if they were born even a few decades ago before there was a personal computer in almost every home and when most people were happy with a few local channels on their TV.

The flip side of living in the information cloud is that it’s never been easier for you to find information and learn virtually any subject. Universities no longer have a monopoly on education and people are no longer dependent on their local library, bookstore or media outlets for materials. Conversely, I never imagined when I was growing up in a small town in the 1970s that, one day, I could be a published author without going through the trials of manuscript submissions, editorial reviews and multiple rejections … but here we are.

Continue reading

Getting Started in Software Development: Part I – More than Writing Code

Ask a lot of people about the requirements to be a computer programmer or software developer and they’ll probably start talking about computer science degrees and years of formal training. Those things don’t hurt but they’re not strictly necessary, either. I personally do not have a degree aside from the accounting diploma I earned from a local college many years ago. I am certified by Microsoft in Windows application development, a certification I earned through self-directed and cooperative study with a few co-workers. Most of what I know about programming is through self-teaching and experience. Nevertheless, with my current experience, all I have to do is post my resume and send copies to a couple of recruiters and my phone starts ringing. It’s about the demonstrated skills, not the paper.

Continue reading

Surviving the Job Interview: Asking the Right Questions

“Do you have any questions for us?”

For some people, that’s the most challenging question in a job interview. They’ll spend time preparing a resume and anticipating the interviewer’s questions but thinking of questions to ask in return gets the least attention. Some people don’t even see the point in asking questions when they’re just hoping to get the job so they can start paying bills again.

Image courtesy of Reyner Media (https://www.flickr.com/photos/89228431@N06/) Used by permission.

Still, the questions that you ask tell the interviewer a lot about you as a potential employee, especially your level of interest in working for the company rather than just collecting a paycheck. When a potential employee has no questions about the company at the end of the interview, he or she can appear lazy or apathetic, which are never desirable traits in an employee.

In any professional position, it’s important to find out as much as you can about the company where you might be working for years. That company will have a place on your resume and will impact the future of your career. The right questions will also demonstrate your knowledge and perspective on your chosen field and that you take the time to do research before making a decision. This demonstrates an intelligence and analytical skill that companies like to see in their professional employees.

Continue reading

Removing Duplicate Records in Microsoft Access

Occasionally, you might have a table in Access that contains duplicate records.  Maybe it was imported from one or more sources or perhaps it was not setup with the necessary key to ensure unique records. Whatever the reason, now you want to make sure that the records in the table are unique. Fortunately, Access offers a couple of options that you can use to remove the duplicates from your table quickly and easily.  This article will explain two methods for removing duplicate information from tables.

Read the full article here on Drewslair.com.

Data Analysis with Microsoft Access

One of the strengths of Access is its ability to import and link to data from different sources.  Excel does this too but with Access you can go on to query and report on the data in ways that Excel doesn’t readily provide.  This can come in handy as part of an application but it’s also useful for quick analysis of new information.

Read the full article here on Drewslair.com.

 

Tweaking the System – Finding the most efficient application design

Like any system, one of the important traits of a good computer program is the efficiency with which it runs. Many people might think of this in terms of how fast it loads or how dependable it is. It can also be measured by how well organized the interface is which determines how successful the program is in enabling the user to do their job. Programmers like myself also look at how much memory the program uses which can determine whether the program will run reliably or whether the user will be plagued with crashes and blue screens.

Continue reading

Using Typed Datasets in Visual Studio

If you’ve worked with Visual Studio or .NET for long, you’re probably familiar with the System.Data.DataSet class which enables you to create a collection of data in memory, often retrieved from an SQL database. Within a dataset object, you can have a series of related DataTables that categorize the data. Moving further down, each table can have multiple
DataRow objects. In effect, you can have an entire relational database in memory to which your application can refer and save changes, although in practice, I usually limit the data in memory to one datatable or even a single datarow if possible, so as to avoid using too much memory.

using System.Data;
using System.Data.SqlClient;

public static DataSet GetQuotes()
{
    DataSet result = new DataSet();
    DataTable dtQuotes = new DataTable("Quotes");

    SqlDataAdapter daQuotes = new SqlDataAdapter(
       "SELECT * FROM Quotes",
        Properties.Settings.Default.AppDataConnectionString);
    daQuotes.Fill(dtQuotes);

    result.Tables.Add(dtQuotes);

    return result;
}

The above C# example code shows a function that returns a dataset containing a table of quotations like the ones you see at the top of the page.  It declares the new dataset and empty table and then uses SQLDataAdapters to retrieve the data from the table into the datatable. The datatable is then added to the dataset which is returned as the output of the function.

The code that calls this function could then reference the data within the dataset by referring to a specific table, rows and items. The following sample calls the function and refers to the Quotes table within the returned dataset, retrieving the QuoteText value from the first row.  (Remember that row and column numbers start with 0.)

DataSet dsQuotes = GetQuotes();
dsCustomer.Tables["Quotes"].Rows[0]["QuoteText"]

Once you understand the ADO.NET dataset and other classes involved, this is a quick way to get data for your application from a database or an XML file and it’s something that every programmer should be able to do. However, it’s also a relatively manual process. As you can see in the last example above, referencing the data that’s returned involves referring to rows by number and columns by number or name. You can use a loop to iterate through the rows or you can bind the table to a data grid but when referring to the columns, you still have to remember the ordinal number or the name that comes from the database. Unless you write nice, organized, classes that group all the database calls in one place, you could also have SQL statements, or preferably stored procedure references, scattered throughout your project.

Typed Datasets

Another type of dataset object in .NET solves some of these problems. The Typed Dataset object is a graphical interface that enables you to simply drag database objects such as tables and stored procedures onto the dataset work area. The interface will then discover and document those objects and create custom data classes for them based on the ADO.NET classes mentioned above. For example, if you drag a Customers table onto the work area, it will create a CustomersDataTable class that can hold a collection of CustomerRow objects based on the table’s design. The CustomerRow class will include a property for each of the fields in the Customers table and these properties can be referred to in code instead of the column name or number. A TableAdapter will also be created to go with the CustomersDataTable and this adapter will store the connection information and all the necessary SELECT, UPDATE, INSERT and DELETE queries can be automatically generated by Visual Studio based on the table structure.

To use a typed dataset, you have to add one as a new component in the project. You can do this by right-clicking on the project in the Solution Explorer or by selecting Add Component from the Project menu in Visual Studio. Select DataSet from the Data components, enter a name at the bottom and click Add.

021-dataset

Typed Datasets are added as new components in a Visual Studio project. (Click for larger view.)

 

Visual Studio will then add the typed dataset to your project and open it in design mode. As you can see by the help text in the screenshot below, you can actually create dataset objects independently from a backend database using the Dataset toolbox but when starting out, your main purpose will probably be to work with database objects. The Server Explorer is the Visual Studio window where you can work with SQL Server databases. If it’s not visible, you can select it from the View menu.

022-newdataset

Data sources such as tables and stored procedures are dragged onto the dataset workspace in order to include them in the dataset.

023-datasetquotes

When the table is added to the dataset, Visual Studio creates the necessary classes and objects to represent the table and its fields, along with table adapters to manage the connection with the database.

The screenshots above show the dataset designer before and after the addition of the Quotes table. As you can see, the dataset designer has discovered three fields within the table and generated a Quotes datatable object for the table along with a QuotesTableAdapter object attached to it. It’s even correctly identified the QuoteID field as the primary key. In the lower
right-hand corner of the screenshot, you can see the properties for the TableAdapter which include the connection details and all queries. The SELECT command is expanded to show part of the SELECT statement that has been automatically generated based on the DataSet’s analysis of the table.

In the Solution Explorer, the typed dataset is contained in an XSD file and you’ll notice a few other files underneath it. These are automatically generated as you make changes within the dataset interface. The main file is the Designer.cs file which holds all of the code that defines and supports the objects created in the interface.

024-codebehind

Automatically generated code for a typed dataset.

As it says in the file header, this file is not meant to be manually changed, although you should take a few minutes to look over it to see the sheer volume of code that Visual Studio generates in the background for just one or two objects within the interface.

Once the typed dataset is in place, you can refer to the custom objects through your code:

using DataDemo.AppDataTableAdapters;

public static AppData.QuotesRow GetSampleData()
{
    QuotesTableAdapter tbaQuotes = new QuotesTableAdapter();
    AppData.QuotesDataTable dtQuotes = tbaQuotes.GetData();

    return (AppData.QuotesRow)dtQuotes.Rows[0];            
}

The above function actually returns an object from one of the custom classes in the typed dataset. Notice the extra Using statement at the top that references the collection of TableAdapters created by the dataset. The function declares a QuotesTableAdapter object which already includes a GetData function that uses the automatically generated SQL SELECT statement to select rows from the table. That function returns a QuotesDataTable object and the first row of that table is returned by this function as the result. The row collection in the QuotesDataTable object actually consists of generic datarow objects and, by default, C# is stricter about conversions than VB.NET so it’s necessary to explicitly cast the row as a QuotesRow. Whatever code is calling this procedure, however, can do something like this:

AppData.QuotesRow rwQuote = GetSampleData();
String QuoteText = rwQuote.QuoteText;
String Author = rwQuote.Author;

The text of the quote and the author which are stored in fields within the table are now properties of the QuotesRow object and can be called by name in the code.

In addition to the advantages in selecting and referencing data, the custom TableAdapter objects have auto-generated methods for updating and deleting rows that can be used as easily as the GetData method was used above.  The TableAdapter manages the connections to the database and the typed dataset contains all of the SQL Statements or stored procedure references needed to carry out the operations.

For more information:

Using ADO.NET for Beginners – CodeProject.com

Using Strongly-Typed Data Access in Visual Studio 2005 and ASP.NET 2.0
4GuysFromRolla.com

Complete Comparison for VB.NET and C# – CodeProject.com