Visual Basic Database Tutorial - Part 2, Page 6
You pick up the telephone and the caller says, "Grassy ass! My name is Maurizio Moroni and I have a question, pleasssse!"
Hmm, you think. You'd really like to get a job with some cool company - so if this dodgy sounding Maurizio is the owner of a customer company, then you'll probably want to sweet talk him. Of course, if he's just a sales representative or some such, you'll want to tell him to stop bothering you.
And wahay, SQL can step in here to help. Let's take a peek at another SQL statement:
Select ContactTitle from Customers where ContactName="Maurizio Moroni"
This one is saying "Show me the contents of the 'ContactTitle' field where the 'ContactName' is Maurizio Moroni"
And what is he? Just a sales representative, so you'd better hang up that telephone. Here's a challenge - tell me what position Marie Bertrand holds - and for which company!
So, that "where FieldName=Criteria" bit is amazingly useful yet surprisingly simple. Except, I bet you were wondering about those "quotes" weren't you? Why do we have to enclose Maurizio's name in quotation marks?
When programming in Visual Basic, you enclose strings in "quotes". And it's snap-snap-snippety-snap in SQL. Similarly, numeric values are not enclosed by "quotes"... not in Visual Basic nor in SQL, for example:
Select UnitPrice from [Order Details] where OrderID=10254
It's all about data types - if the database recognises a particular field as a text field, it expects "quotes". If it's numeric, it doesn't. If it's a date, it's completely different. Don't worry about this for now - we'll figure an easier way of creating SQL statements in the next section.
Crikey, I'm babbling aren't I? Am I side-tracking? Is Karlos off on another tangent? Err, possibly, yes.
Well, I'll shutup now. In the next section, we'll be creating more of these statements... but in a really cool way that takes virtually no effort. Sounds good to me...
Page 6 of 8