Easy Insert with ASP.NET 2.0

Using ASP.NET 2.0 makes inserting information from web user interfaces to a database a snap. Based on the 3-tier software architecture paradigm, an explanation and example of how to accomplish this task is below. The example will start with a simple data model you can use to insert the sample data. Next, there will be a proposed interface design to support the database. An example of how the ASP.NET code behind the interface can be set up to handle the data pass and lastly, a single line of code written to execute the passing of data from the ASP layer to the database.

First, construct a simple database using some ADO compatible database software such as MS SQL or Access. For the purpose of our example we will construct a model based on the following design.

FIELD TYPE
Name Text
Age Integer
Gender Integer

Next, create an interface to support the data model. This example uses Visual Basic as the programming code by which the data insert operation is executed. Similar results may be accomplished using another language such as C#. A text box control is suggested for the name field. A populated drop-down list is suggested for age, and a radio button list is suggested for the gender field. Also, a button should be added for the end-user to click as a trigger to perform the actual insert.

Don’t forget to add a SQL DataSource Control; configure it to include insert capabilities in advanced mode and include all the fields from the database. An example could look like:

<form id="form1" runat="server">
<div>
    Name:
    <asp:TextBox ID="TextBox1" runat="server"></asp:TextBox>
    Age:
    <asp:DropDownList ID="DropDownList1" runat="server">
        <asp:ListItem Text="18-25" Value="0" />
        <asp:ListItem Text="26-32" Value="1" />
        <asp:ListItem Text="33-40" Value="2" />
    </asp:DropDownList>
    Gender:
    <asp:RadioButtonList ID="RadioButtonList1" runat="server">
        <asp:ListItem Text="Male" Value="0"></asp:ListItem>
        <asp:ListItem Text="Female" Value="1"></asp:ListItem>
    </asp:RadioButtonList>
</div>
</form>

Now, in the ASP.NET interface layer, assign the appropriate parameters to the appropriate fields.

<asp:SqlDataSource ID="SqlDataSource1" runat="server">
    <InsertParameters>
        <asp:ControlParameter Name="Name" ControlID="TextBox1"
            PropertyName="Text" Type="Char" />
        <asp:ControlParameter Name="Age" ControlID="DropDownList1"
            PropertyName="SelectedValue" Type="Int32" />
        <asp:ControlParameter Name="Gender" ControlID="RadioButtonList1"
            PropertyName="SelectedValue" Type="Int32" />
    </InsertParameters>
</asp:SqlDataSource>

This code observes the contents of the controls named in the ControlID tags and points them in the direction of the database’s ControlParameter Name which specifies where in the database the information should go. Of course, data types are specified in Type and PropertyName is the control property from which the information should be extracted.

Now, here comes the fun part – a single line of Visual Basic to handle the pass from ASP.NET to the database. Simply double-click the button created in the user-interface, and add this line:

SqlDataSource1.Insert()

If all went as intended, the project executes and the user should be able to type in their name to the text box on the interface, select their age from the drop down list, select their gender from the radio buttons, click to submit and (voila!) the information is inserted into the database build from the initial data model.

This is one example of how more advanced versions of ASP.NET reduce development time. The ease with which data-driven applications may be constructed using these tools and supporting technologies is a testament to rapid application development techniques as they are applied to the web.

Top 6 Reasons Why You Should Build a Windows 8 App

By: Jason Carter

Windows 8 is an odd OS.
I’m not talking about the initial “Who moved my cheese?” shock of the new user interface.  You get used to it.  After the initial week or two of daily usage, you learn to be just as productive as before.
No, what I’m talking about is Windows Store apps.  Windows Store apps are the full-screen apps that launch from your Start Screen tiles when you first log in to Windows 8.

I like Windows Store apps, even though the full-screen experience can be a bit disorienting when you are used to the Windows desktop. The name Windows Store is a bit of a misnomer, because the apps in the store don’t have any actual windows.  Even after several months of Windows 8 being my primary OS, I still get a bit of vertigo every time I enter full-screen land.

However, the design and typography of full-screen mode makes for a beautiful experience, especially when reading articles.  And I expect that once I replace my laptop with a device that has a touch screen, the touch-friendliness will be even more appreciated.

In fact, the only gripe I have about Windows Store apps is that there aren’t more of them.
So here is my unabashed plug why You the Company® and You the Individual Developer® should build your own Windows Store apps.

1. Huge Windows Market Share
Even though Windows Store apps run on Windows 8 tablets, they also run on PCs.  This is way different from the fragmented worlds of Apple iOS and Mac OS X.

Windows Store apps don’t have to rely on the sales of Windows tablets or phones to be successful.  Windows already constitutes over 90% market share of all desktop OSs, and over 70%-80% of all device OSs, including mobile!

And while Windows 8 is still a new operating system, it is already selling well and achieved significant buy-in from hardware manufacturers and even the US Department of Defense. Trust me, it will sell, and will attain market dominance in the next three years.

2. Portability
From a consumer standpoint, I like to have access to my apps on whatever machine I’m using. Windows Store apps run natively on both Windows 8 PCs and tablets, without having to wait a year for a company to come out with mobile version of its software.

From an economics standpoint, Windows Store apps are great, because you just develop the code once, and then you automatically get access to markets for both Windows 8 PCs and tablets.

From the standpoint of a developer, I like being able to develop something once and be done.  With software, less code not only means less work, but it also means fewer bugs.

With a well-engineered software package that separates the user interface design from the code that does the heavy lifting, you can use the Shared Core feature of Windows Phone 8 to get your Windows Store app to run on Windows Phone 8 with just a little extra UI design work.

And if portability is really your thing, you can use Portable Class Libraries to share your core code with normal .NET applications (including ASP.NET, Windows Forms, and Windows Presentation Foundation programs), Silverlight, Windows Phone 7, and even the Xbox 360.

3. Standing Out
The first thing most people do once they understand how apps work on the Windows 8 Start Screen is open the Store app and start poking around.

Right now, the Windows Store is so new that many of the big name companies haven’t yet ported their mobile apps to it.

While this is disappointing from a consumer perspective, this presents smaller businesses and individual developers with amazing opportunities to establish their own branding with fewer competitors.

4. Enterprise-Friendly
Windows Store apps are just full of misnomers.  Not only do they not have windows, but you don’t even need to distribute them through the Store.

Microsoft System Center 2012 and Windows Intune come with a feature called the Self-Service Portal, which enables businesses to develop their own private Windows Store line of business apps, and then deploy them in-house without ever touching the Windows Store.

The Self-Service Portal also allows you to personalize which apps are available to which user groups, lock down apps on stolen or lost devices, and even revoke privileges to apps entirely once employees leave the company.

As an added bonus, there is no premium account fee for distributing in-house apps to Windows 8 Enterprise devices on your domain.  Apple charges $299 for the privilege of bypassing their store.

5. Worldwide Marketplace
Windows enjoys almost universal market share in the world’s emerging markets of Asia and South America, where the post-PC age is still hampered by economics and infrastructure. Windows 7 has achieved rapid adoption there, so Windows 8 should have little trouble being accepted as well.

Windows Store apps are perfect for reaching lucrative world markets, since the Windows Store is already available in over 120 countries worldwide.

6. Individual Developers Pay Less
Individual developers pay only $49/year for an account that can distribute apps to both Windows 8 tablets and PCs.

While this can seem like a lot of money to tinkerers used to the one-time Google Play store fee of $25 for developing Android apps, it is still much better than the Apple developer account fee of $99/year for iOS and $99/year more for OS X.

It is easy to justify $4/month for the right to publish your software to the ecosystem that is on the start screen of every Windows 8 device out there.  Since Windows 8 sold over 60 million licenses in the first month and a half it was out, it shouldn’t take long before the cost-to-audience ratio for Windows 8 becomes more lucrative than for Apple iOS.

So now you have all the reasons you need to justify making a Windows 8 Store app.  Do it.  Do it now.

About our Author: Jason Carter is a Microsoft-certified senior software developer with DLS Software Studios and a lover of all things geeky.  He spends most of his free time reading, tinkering with new technology, and playing games. He is a father, a husband, a former Peace Corps volunteer, a gardener, a back country outdoors-man, and a black-belt in Bujinkan budo taijutsu.

SOAP vs REST

As a developer, you should know why and when you should use SOAP versus REST. Both have value and their own benefits and challenges as a web service so how do you know which to use?

I came across an old post by Steve Francia that still has some valid points about the differences between SOAP and REST and why anyone would choose each of them. To summarize his points:

 Why REST:

  • Simpler based on using standard HTTP
  • SOAP only permits XML while REST permits many different data formats
  • Better performance and scalability
  • REST reads can be cached and SOAP reads cannot

Why SOAP:

  • WS-Security : SOAP supports SSL in addition to WS-Security which adds enterprise security features
  • WS-AtomicTransaction: SOAP works for ACID transactions over a service. It can provide 2-phase commit across transactional resources.
  • WS-ReliableMessaging: SOAP has successful/ retry logic built in and provides end to end reliability even through SOAP intermediaries

Interested in reading more? Check out his article at SFP13.com.

 

At DLS Software Studios, we want to provide you with the very best IT solutions for your business. Contact us todayto discuss how our software development experts and IT consultants can bring cost-effective, best in class solutions to your organization. While we are located in the Chicago area, we take on projects throughout the country.

Any project, anywhere, anytime – We’ve got the solution for you.

What does our Microsoft competency mean for your business?

software development partnerWe are proud to be part of the Microsoft Partner Network and are certainly very proud of our competency in Software Development. I always mention it when meeting with potential clients and I often tweet about this achievement to promote our expertise. But, what exactly does our Microsoft competency mean for you? Microsoft explains it like this:

By attaining a Microsoft competency, we have met extensive technology requirements and demonstrated expertise through rigorous exams, culminating in Microsoft certifications. We have also been recommended by our customers. Our skills, support, and knowledge have been tested and proven by successful implementations in specific technology areas.

Additionally, our Microsoft competency provides us with early access to new software and specialized technical support and services from Microsoft that help us serve you better.

We look forward to sharing our expertise and experience with you—and finding the right solutions for your business. Contact us today to discuss how we can help your business.

 

Software Development – Yield-Return for More Efficient Code

In the world of C# programming, the yield-return mechanism isn’t used very often but can be used to help developers write cleaner and more efficient code. When might a yield-return make sense? According to Visual Studio magazine, you may want to consider a yield-return in the following scenarios:

  • Generating a sequence of strings where each string in the sequence depends on the value of the previous string
  • Processing a text file sequentially where different kinds of lines are treated differently
  • Sequentially filtering or modifying a large List collection of objects

For more on how software developers might utilize the C# yield-return, check out the original article here.

 

At DLS Studios, we want to provide you with the very best IT solutions for your business.  Contact us today to discuss your IT Project. We are based in Chicago but take on projects throughout the country. 

Page 1 of 41234