Updating a Database from WinForms Controls

Old school programming, whereby the programmer reads control values and writes inline SQL, still works, but it's so 90s. If you are new to WinForms or Web programming but experienced, peruse the article and then master LINQ.

Introduction



So much about programming technology changes and a lot of it stays the same. One reader wrote and asked me how to update a database from WinForms controls (not a grid), writing SQL inline. I haven't used this approach in a while, so I had no ready-made examples. I did whip one up and send it to him, though. Another reader wrote and told me that my Sieve of Eratosthenes prime number algorithm sucked (his word, not mine), but after he told me that he had been writing it and re-writing it for 40 years I didn't feel so bad.

Of all of the reader email I get, just these two things alone reminded me that of course I don't know everything, and many of you are working at a widening level of experience. To that end, this article is an old school article that shows new-to-WinForms programmers how to read data from controls and contrive SQL that updates a database.

I would encourage anyone reading this article, working at this level, to immediately upgrade to stored procedures very quickly and then move on to LINQ. Inline SQL works fine, but it's so 90s. LINQ, LINQ to SQL, LINQ to Entities, and declarative programming will help you be much more productive and are much cooler technologies.



Describing the Scenario



Maybe you are a FoxPro programmer or one of the dwindling numbers of COBOL or assembler programmers finally moving over to Web and Windows programming with .NET, or maybe you are just getting started. (We were all there once, and in this business everyone is just getting started with some new technology—like Ruby, F#, or LINQ to Entities.) The challenge is how to get data from a WinForm control (or controls) into your database. The way you can do it (but fewer of us will going forward) is to read a value, format it as part of a SQL query, and invoke the SQL command.

Read the Rest of this Article at Developer.com

Regional Articles
- Updating a Database from WinForms Controls Alabama
- Updating a Database from WinForms Controls Alaska
- Updating a Database from WinForms Controls Arizona
- Updating a Database from WinForms Controls Arkansas
- Updating a Database from WinForms Controls California
- Updating a Database from WinForms Controls Colorado
- Updating a Database from WinForms Controls Connecticut
- Updating a Database from WinForms Controls DC
- Updating a Database from WinForms Controls Delaware
- Updating a Database from WinForms Controls Florida
- Updating a Database from WinForms Controls Georgia
- Updating a Database from WinForms Controls Hawaii
- Updating a Database from WinForms Controls Idaho
- Updating a Database from WinForms Controls Illinois
- Updating a Database from WinForms Controls Indiana
- Updating a Database from WinForms Controls Iowa
- Updating a Database from WinForms Controls Kansas
- Updating a Database from WinForms Controls Kentucky
- Updating a Database from WinForms Controls Louisiana
- Updating a Database from WinForms Controls Maine
- Updating a Database from WinForms Controls Maryland
- Updating a Database from WinForms Controls Massachusetts
- Updating a Database from WinForms Controls Michigan
- Updating a Database from WinForms Controls Minnesota
- Updating a Database from WinForms Controls Mississippi
- Updating a Database from WinForms Controls Missouri
- Updating a Database from WinForms Controls Montana
- Updating a Database from WinForms Controls Nebraska
- Updating a Database from WinForms Controls Nevada
- Updating a Database from WinForms Controls New Hampshire
- Updating a Database from WinForms Controls New Jersey
- Updating a Database from WinForms Controls New Mexico
- Updating a Database from WinForms Controls New York
- Updating a Database from WinForms Controls North Carolina
- Updating a Database from WinForms Controls North Dakota
- Updating a Database from WinForms Controls Ohio
- Updating a Database from WinForms Controls Oklahoma
- Updating a Database from WinForms Controls Oregon
- Updating a Database from WinForms Controls Pennsylvania
- Updating a Database from WinForms Controls Rhode Island
- Updating a Database from WinForms Controls South Carolina
- Updating a Database from WinForms Controls South Dakota
- Updating a Database from WinForms Controls Tennessee
- Updating a Database from WinForms Controls Texas
- Updating a Database from WinForms Controls Utah
- Updating a Database from WinForms Controls Vermont
- Updating a Database from WinForms Controls Virginia
- Updating a Database from WinForms Controls Washington
- Updating a Database from WinForms Controls West Virginia
- Updating a Database from WinForms Controls Wisconsin
- Updating a Database from WinForms Controls Wyoming
Related Articles
- Replication and Microsoft SQL Server 2000
Data Replication is a powerful feature of SQL Server. SQL Server 7.0 provided many improvements from previous versions, and SQL Server 2000 builds on those features and adds more to increase the reliability, ease of use, and management of replication.
- Using More Advanced JDBC Features
- Day 1: Learning the Basics of PL/SQL
- Exploring the Oslo Repository
- What Is a Database Administrator?
- Microsoft SQL Server 2000 Error Messages
- User Code: EJB with Composite Primary Key in ODBMS
- An Overview of Java Database Connectivity
- The Elements of a Database
- Practical Uses for DTS

Rss   Delicious   Digg   Add To My Yahoo   Add To My Google   Bookmark   Search Plugin

Topics:
Architecture & Design Languages & Tools Project Management Web Services
Database Microsoft & .NET Security Wireless
Java Open Source Techniques XML