-(nsstring *) databasefilepath{ //access to the database path via nsstring *url = [nssearchpathfordirectoriesindomains (Nsdocumentdirectory, nsuserdomainmask, yes) lastobject]; nsstring *filename = [url stringbyappendingpathcomponent:@ "Sqltjl.sqlite"]; return filename;} -(void) fmdbdata{ //get the database _db = [fmdatabase databasewithpath:[self databasefilepath]]; //Open Database if ([_db open]) { //Build table bool result = [_db executeupdate:@ "Create table if not exists tjl_student (Name text) "]; if ( Result) { &nbsP; nslog (@ "Build table Success"); }else{ nslog (@ "Build table Failed"); } [_db close]; }}//inserting data-(void) Insetsqlto: (nsstring *) string{ [_db open]; if ([_ Db open]) { BOOL res = [_db executeupdate:@ "insert into tjl_student (name) values (?)", string]; if (!res) { nslog (@ "error"); }else{ nslog (@ "Success to insert"); } [_db close]; }}//Delete data-(void) Deleteopen: ( nsstring *) dataname{ if ([_db open]) { nsstring *deletesql = [nsstring stringwithformat:@ "delete from tjl_student %@ ", dataname]; bool res = [_db executeUpdate:deleteSql]; if (!res) { nslog (@ "Error when delete db table "); }else{ nslog (@ "success to delete db table"); } [_db open]; }}//Modifying Data-(void) Updataname: (nsstring *) string{ if ([_db open]) { nsstring *updatesql = [nsstring stringwithformat:@ " Update tjl_student '%@ ' ", string]; bool res = [_db executeUpdate:updatesql]; if (! RES) { nslog (@ "Error when update db table "); }else{ nslog (@ "success to insert db able"); } [_db close]; }}//query data-(void) Seacher: (nsstring *) seaharname{ if ([_db open])  {  &Nbsp; fmresultset *rs = [_db executequery:@ "SELECT * from tjl_student "]; while ([Rs next]) { _Devices = [rs stringforcolumn:@ "Name"]; nslog (@ "is text---->>> %@ ", [rs stringforcolumn:@" name "]); } }}
Fmdb Common operations