Topics
- Introduction 1
- SQL Yoga Primer 3
- Notes on Error Reporting 3
- General Concepts 4
- Database Objects 5
- Database Connections 5
-
SQL Query Objects
6
- Introduction to SQL Query Objects
- Creating A SQL Query Object
- How Do I Create Records In a Database Table Using a SQL Query Object?
- How Do I Delete Records From the Database Table Using a SQL Query Object?
- How To Use Cursors With a SQL Query Object
- How Can I Convert a User Search String Into An AND/OR Search When Generating a Query?
- Record Objects 5
- Table Objects 4
- Table Relationships 3
Other Resources
How-tos
- Lessons
- Signing Your Applications and Building Installers
GLX Application Framework
- GLX Application Framework 1.1
- Converting An Existing Application To Use The Framework
SQL Yoga
- SQL Yoga
- SQL Yoga Examples
- SQL Yoga To-Do Application
- SQL Yoga IDE Plugin
Plugins, Externals and Libraries
- Plugins
Comments
0 for this lesson
Create Records in the Database Using SQL Record Objects
You can create records in your database using a SQL Record object. This lesson will show you how using sqlrecord_create.
Create SQL Record Object
The first step is to create a SQL Record object.
put sqlrecord_createObject("lessons") into theRecordA
## theRecordA is now an array that includes all fields in the 'lessons' table.
Fill In Values For Table
Now that you have a SQL Record object you can set the column values for the new record. In this example the "title" column and "description" column are being assigned values.
sqlrecord_set theRecordA, "title", "My Lesson"
sqlrecord_set theRecordA, "description", "A short lesson I made."
Create Record in Database
Once you are done assigning values to the columns you can create the record in the database.
sqlrecord_create theRecordA
put the result into theError
put it into theAffectedRows
## In addition to the other column values, theRecordA now contains the database value for the 'id' (primary key) column.


Add your comment