Visual Basic Database Tutorial - Part 2, Page 5
Phew! I'm glad that's out of the way. Hit F5 to run the application!
Type 'Customers' in the text box and hit your command button. You should notice that your grid has suddenly filled with dozens of weird-sounding businesses.
That's brilliant... but let's pretend we only wanted to show your user the contact names for each company. Ahh. Problem.
Actually, it isn't. We can do this using one of those database questions in Structured Query Language!
Top Tip: Don't call database questions 'database questions'. Sure I might do it, but that's because this is my tutorial and I have permission. You should probably call them SQL statements
OK, tap the following into your text box and click the command button:
Select ContactName from Customers
Don't worry about capitalisation and the like - just tap it in and hit the button. You should've got a list of all the contact names - don't worry if the FlexGrid is cutting off the end of names, that's just a sizing issue.
In English, this statement is saying to the database: "Give me everything from the 'ContactName' field, which lies inside the Customers table... OK?"
Here's another example:
Select ContactName, ContactTitle from Customers
This one is saying "Show me everything in the 'ContactName' and 'ContactTitle' fields, which are hiding in the Customers table... now!"
But just before you start telling all your friends how simple SQL is... errm, don't. It can get much more complicated... yah booh, sucks to you, SQL!
Page 5 of 8