Parsing Your SQL Statement–A Better Way

Now that we’ve seen the program work with manually creating the SQL statements let’s look at a quick procedure to parse the SQL statement and create the parameters for us. Of course you could use the CommandBuilder object, but that would be too easy—we are programmers after all.

To prepare for this project, create a new Windows Forms project and call it ADOBook06-04. You can copy the form file from the previous project into this project. We will then modify the code in the new project. You can also download the code from the book’s web site if you don't want to type it in.

As it turns out, SQL statements are well formed and have a very predictable pattern. This makes parsing them relatively easy. If you ...

Get ADO.NET Programming in Visual Basic™ .NET now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.