Course Hero Logo

Lab 12a Inserting A Record.pdf - CT044-3-1-IOOP Database...

Course Hero uses AI to attempt to automatically extract content from documents to surface to you and others so you can study better, e.g., in search results, to enrich docs, and more. This preview shows page 1 - 3 out of 4 pages.

CT044-3-1-IOOPDatabase I2aSQL InsertPage 1 of 4Level 1Asia Pacific University of Technology and InnovationAuthor: Leong Swee KeeInserting A RecordInserting a record to a database is done through the INSERT statement in SQL. The INSERTstatement has the following syntaxes:Method 1INSERT INTO table_nameVALUES (value1, value2, value3,...)Method 2INSERT INTO table_name (column1, column2, column3,...)VALUES (value1, value2, value3,...)wherecolumnare the name of the data fields (columns) that you want to insert into andvaluesarethe data values to be inserted.In .NET applications, normally you would use a connection object and a command object to insertrecords. Another method of adding record is by using adata-adapter. Either way will work, it isjust a preference.The connection object will provide the information to the application as to how to connect todatabase (i.e. provider, data source, security) and the command object will be used for executingthe SQL insert command.Assume that you are an administrator of a system which allows you to add a new user to theUserstable.1.Open your previous project in Visual Studio and we will continue from here.2.Add a newWindows Formto your project by right clicking the project name on theSolutionExplorer. A context menu will be displayed, then selectAdd>>Windows Form
CT044-3-1-IOOPDatabase I2aSQL InsertPage 2 of 4Level 1Asia Pacific University of Technology and InnovationAuthor: Leong Swee Kee3.

Upload your study docs or become a

Course Hero member to access this document

Upload your study docs or become a

Course Hero member to access this document

End of preview. Want to read all 4 pages?

Upload your study docs or become a

Course Hero member to access this document

Term
Summer
Professor
N/A
Tags
Subroutine, Leong Swee Kee

Newly uploaded documents

Show More

Newly uploaded documents

Show More

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture

  • Left Quote Icon

    Student Picture