Data Entry |
|
Fundamentals of Table Data Entry
Introduction |
Data entry consists of populating a table with the necessary values it is supposed to hold. In the previous lessons, we saw that, to organize its data, a table is divided in sections called columns. The values common to an entry under each column constitute a row or record and a row is made of cells: as you may realize, everything we reviewed about the organization of a table, when studying data sets, is also valid here.
Data entry consists of filling the cells under the columns of a table.
Practical Learning: Introducing Data Entry |
|
private: System::Void btnCreateDB_Click(System::Object * sender, System::EventArgs * e) { String *strConnection = String::Concat(S"IF EXISTS (SELECT * " S"FROM master..sysdatabases " S"WHERE name = N'CountriesStats')" S"DROP DATABASE CountriesStats;" S"CREATE DATABASE CountriesStats;"); SqlConnection *conDatabase = new SqlConnection(S"Data Source=(local);Integrated Security=sspi"); SqlCommand *cmdDatabase = new SqlCommand(strConnection, conDatabase); conDatabase->Open(); cmdDatabase->ExecuteNonQuery(); conDatabase->Close(); } |
private: System::Void btnCreateContinents_Click(System::Object * sender, System::EventArgs * e) { String *strCreate = S"IF EXISTS(SELECT name FROM sysobjects " S"WHERE name = N'Continents' AND type = 'U')" S"DROP TABLE Continents;" S"CREATE TABLE Continents (" S"ContinentName varchar(100)," S"Area varchar(30), " S"Population varchar(30));"; SqlConnection *conDatabase = new SqlConnection( S"Data Source=(local);Database='CountriesStats';Integrated Security=yes"); SqlCommand *cmdDatabase = new SqlCommand(strCreate, conDatabase); conDatabase->Open(); cmdDatabase->ExecuteNonQuery(); conDatabase->Close(); } |
private: System::Void btnCreateCountries_Click(System::Object * sender, System::EventArgs * e) { String *strCreate = S"IF EXISTS(SELECT name FROM sysobjects " S"WHERE name = N'Countries' AND type = 'U')" S"DROP TABLE Countries;" S"CREATE TABLE Countries (" S"CountryName varchar(120)," S"Area varchar(30)," S"Population varchar(30)," S"Capital varchar(80)," S"Code char(2));"; SqlConnection *conDatabase = new SqlConnection( S"Data Source=(local);Database='CountriesStats';Integrated Security=yes"); SqlCommand *cmdDatabase = new SqlCommand(strCreate, conDatabase); conDatabase->Open(); cmdDatabase->ExecuteNonQuery(); conDatabase->Close(); } |
private: System::Void btnClose_Click(System::Object * sender, System::EventArgs * e) { Close(); }
Displaying the Table For Data Entry
Before performing data entry from the SQL Server Enterprise Manager, you must first open it in a view that display its records. To do this, you can locate the database it belongs to and click the Tables node. In the right frame, click the table's name to select it. Then, on the main menu, click Action -> Open Table -> Return all rows. Alternatively, you can right-click the table in the right frame, position the mouse on Open Table, and click Return all rows.
If you are working in Server Explorer, expand the name of the server under the Servers node, then expand SQL Servers, followed by the name of the server, followed by the database, and followed by the Tables node. Finally, double-click the desired table.
If this is the first time you open the table for data entry, it would display the label of each column on top and empty cells under it:
If the table already contains some records, they would display under the column headers.
|
||
Previous | Copyright © 2005-2016, FunctionX | Next |
|