Life of a Computer Programmer

I have a love/hate relationship with Microsoft’s Visual Basic .NET

On the one hand, it allows me to do a lot of things that I was never able to do before. On the other, I have to learn how it does things, as opposed to the previous version.

In my job, I have to do a fair amount of database programming. Visual Basic had one way of accessing databases, VB.NET has another. Oh goody.

There’s this thing called the CommandBuilder. Useful tool, if only it worked correctly.

I just spent several hours wrestling with the stupid thing – trying to insert a row into a database. That shouldn’t be hard. I could write the code in five minutes in VB6. I can in VB.NET as well. Unfortunately, the VB6 code would work, the VB.NET code didn’t. “Syntax Error in INSERT Statement” it kept telling me.

This was an INSERT statement that the CommandBuilder was meant to create itself. Oh, goody.

The problem? A couple of the database fields were reserved words. So, I had to enclose them in marks to say “These are Fields, not Reserved Words.”

How do you do that? Well, apparently there are two properties of the Command Builder that you can set: .QuotePrefix and .QuoteSuffix

When set to “[” and “]” everything started working.

The manual? What’s that?

Oh well. It works now – and a program that I wrote to save myself some time (and that took about 6 hours to get working) may now start saving some time for myself.

Leave a Reply

Fill in your details below or click an icon to log in: Logo

You are commenting using your account. Log Out /  Change )

Google+ photo

You are commenting using your Google+ account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )


Connecting to %s