Learning SQL statements-select (1): specifying a table

Source: Internet
Author: User
// Select * from country {all fields in the country table are case-insensitive, but the keywords should be capitalized}

  

In this example:


Code File:
Unit unit1; interfaceuses windows, messages, sysutils, variants, classes, graphics, controls, forms, dialogs, stdctrls, extctrls, grids, dbgrids, DB, ADODB; type tform1 = Class (tform) Panel1: tpanel; button1: tbutton; button2: tbutton; dbgrid1: TDBGrid; performance1: tdatasource; adodataset1: dependencies; Procedure dependencies (Sender: tobject ); procedure button1click (Sender: tobject); Procedure button2click (Sender: tobject); end; var form1: tform1; implementation {$ R *. DFM} {view database dbdemos. country table in MDB} procedure tform1.button1click (Sender: tobject); begin adodataset1.close; adodataset1.commandtext: = 'select * from country '; adodataset1.open; end; {view database dbdemos. in mdb, the customer table} procedure tform1.button2click (Sender: tobject); begin with adodataset1 do begin close; commandtext: = 'select * From customer'; open; end; {Control Association and database connection: dbdemos. MDB} procedure tform1.formcreate (Sender: tobject); var mdbfile: string; begin {obtain the data file of codegear shared installation: dbdemos. MDB path} mdbfile: = getenvironmentvariable ('commonprogramfiles'); {C: \ Program Files \ common files} mdbfile: = mdbfile + '\ codegear shared \ data \ dbdemos. MDB '; adodataset1.connectionstring: = 'provider = Microsoft. jet. oledb.4.0; Data Source = '+ mdbfile +'; persist Security info = false'; dbgrid1.datasource: = performance1; performance1.dataset: = adodataset1; end.
 
   
 

Form file:

Object form1: tform1 left = 0 Top = 0 caption = 'form1' clientheight = 407 clientwidth = 645 color = clbtnface font. charset = default_charset font. color = clwindowtext font. height =-11 font. name = 'tahoma 'font. style = [] oldcreateorder = false oncreate = formcreate pixelsperinch = 96 textheight = 13 object dbgrid1: TDBGrid left = 0 Top = 35 width = 645 Height = 372 align = alclient datasource = performance1 taborder = 0 titlefont. charset = default_charset titlefont. color = clwindowtext titlefont. height =-11 titlefont. name = 'tahoma 'titlefont. style = [] end object Panel1: tpanel left = 0 Top = 0 width = 645 Height = 35 align = altop caption = 'panel1' taborder = 1 object button1: tbutton left = 16 Top = 4 width = 75 Height = 25 caption = 'button1' taborder = 0 onclick = button1click end object button2: tbutton left = 97 top = 4 width = 75 Height = 25 caption = 'button2' taborder = 1 onclick = button2click end object performance1: tdatasource dataset = adodataset1 left = 184 Top = 112 end object adodataset1: TADODataSet cursortype = ctstatic parameters = left = 232 Top = 184 endend
 
  
 

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.