http://www.waynedeng.com/blog/showlog.asp?cat_id=25&log_id=500cf The operation of the data is made through CFQuery, which is far more than the recordset in the ASP from the ASP. Object. However, there is an object in ColdFusion MX, we also come to pack a simple Recordset Component!
The following is an application example, familiar with the RecordSet Object, don't understand,? It is easy to operate.
The following is the code:
"); rs.movenext (); Writeoutput (Rs.Getfield ("Title") & "
"); rs.movelast (); Writeoutput (RS.Getfield ("Title") & "
"); // Add a new record rs.addNew (); rs.setfield ("Title", "INSERT TEST"); rs.setfield ("Content "," This is a test "); rs.setfield (" artileid ", 8); rs.setfield (" IMG "," "); rs.Update (); // Modify The second record rs.rownum = 2; rs.setfield ("Title", "Update Test"); rs.Update (); cfscript>
Below is Recordset.cfc
Cfnews.Model.db.RecordsetComponent Recordset (Recordset Class)
hierarchy: WEB-INF.cftags.component CFNews.model.db.RecordSetpath: C: /Inetpub/wwwroot/CFNews/model/db/RecordSet.cfcproperties: methods: addNew, delete, edit, getBySQL, getByTable, getField, moveFirst, MoveLast, MoveNext, MovePrev, SetField, Update * - Private Method
addNew public addNew () Output: supresseddelete public delete () Output: supressededit public edit () Output: supressedgetBySQL public getBySQL (required string sql, required string recordSource) get a Query object by a sql sentenceOutput: supressedParameters: sql: string, required, sql recordSource: string, required, recordSource getByTable public getByTable (required string tableName, required string recordSource) get a Query object by a table nameOutput: supressedParameters: tableName: string, required, tableName recordSource: string, required, recordSource getField public getField (required string fieldName) get field value by field nameOutput: supressedParameters: fieldName: string, required, fieldName moveFirst public moveFirst () Output: supressedmoveLast public moveLast () Output: supressedmoveNext public moveNext () Output: supressedmovePrev public movePrev () Output: supressedsetField public setField (Required String FieldName, Required String Value, string fieldType) Output: supressedParameters: fieldName: string, required, fieldName value: string, required, value fieldType: string, optional, fieldType update public update (string IDName) Output: supressedParameters: IDName: string, optional, IDName
The following is the code:
Cffunction name = "getfield" access = "public" output = "false" hint = "get Field value by field name"> Name = "RecordsetDelete"> delete from # this.tablename # where