• Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint
Share this Page URL
Help

Chapter 7. Using Databases > Simplified Database Connectivity

Simplified Database Connectivity

<cfinsert> and <cfupdate> are tags that simplify the process of database inserts and updates, respectively. They effectively build a dynamic SQL statement based on the FORM variable structure and submit it like a standard <cfquery> with the appropriate SQL statement. Consequently, they are easier to use than <cfquery> and SQL code, but they are also less flexible and have some limitations. Only datasource and tablename are required attributes. <cfinsert> and <cfupdate> are used like this:

<!--- inserting a record --->
<cfinsert datasource="dsn"
          tablename="users"
          formfields="LastName, FirstName">

<!--- updating a record --->
<cfupdate datasource="dsn"
          tablename="users"
          formfields="LastName, FirstName">


PREVIEW

                                                                          

Not a subscriber?

Start A Free Trial


  
  • Creative Edge
  • Create BookmarkCreate Bookmark
  • Create Note or TagCreate Note or Tag
  • PrintPrint