New topic: Export to .csv
<http://forums.realsoftware.com/viewtopic.php?t=32257> Page 1 of 1 [ 2 posts ] Previous topic | Next topic Author Message rlinsurf Post subject: Export to .csvPosted: Fri Jan 29, 2010 10:52 pm Joined: Tue Mar 21, 2006 12:49 am Posts: 191 I'm trying to export the contents of an RB database to a .csv file. So far I have this: Code:dim f as folderitem dim tos as textOutputStream dim s as string dim i as integer f= GetSaveFolderItem("text/plain","Test.csv") if f = nil then exit sub //create file tos = f.CreateTextFile if tos = nil then MsgBox("The file could not be created!") exit sub end if dim sql as string ="SELECT jottsText.ROWID, jottsText.ID, jottsText.text, jottsText.page, jottsText.dateHolder, jottsText.created, jottsText.modified FROM jottsText" // run the query dim rs as recordset = ModDB.SQLSelect( sql ) while not rs.eof for i = 0 to rs.fieldCount s="" s=s+rs.idxField( i ).stringValue+ "," //csv format tos.WriteLine s.left(s.len-1) next rs.moveNext wend tos.Close But I'm getting a nilobject here: Code:s=s+rs.idxField( i ).stringValue+ "," //csv format Top rlinsurf Post subject: Re: Export to .csvPosted: Fri Jan 29, 2010 11:27 pm Joined: Tue Mar 21, 2006 12:49 am Posts: 191 Well, I corrected this: Code:for i = 1 to rs.fieldCount And that got rid of the nil error. Top Display posts from previous: All posts1 day7 days2 weeks1 month3 months6 months1 year Sort by AuthorPost timeSubject AscendingDescending Page 1 of 1 [ 2 posts ] -- Over 1500 classes with 29000 functions in one REALbasic plug-in collection. The Monkeybread Software Realbasic Plugin v9.3. http://www.monkeybreadsoftware.de/realbasic/plugins.shtml [email protected]
