NetAdminTools.com
 
SignalQ Sites:
NetAdminTools - Coprolite - NoNIC - SpotBridge - NAW
RoboCoop - AreWeDown - SolarPower - SysAdminTools
Xfig - Gold Loaf - GeekPapa - FixGMC - MCJ - FixRambler
Categories:
GNU/Linux | Homebrew designs | Perl | Administration | Backup/Recovery | Bugs/Fixes | Certification | Database | Email | File/Print | Hardware | Information Grab Bag | Interoperability | GNU/Linux ABCs | Monitoring | Name Resolution | Network Services | Networking | Remote Control | Security | Desktop | Web | BSD | Solaris | GIAGD | REALbasic

Last 30 Days | Last 60 Days | Last 90 Days | All Articles | RSS | Hail Support


Categories:
·GNU/Linux
·Homebrew designs
·Perl
·Administration
·Backup/Recovery
·Bugs/Fixes
·Certification
·Database
·Email
·File/Print
·Hardware
·Information Grab Bag
·Interoperability
·GNU/Linux ABCs
·Monitoring
·Name Resolution
·Network Services
·Networking
·Remote Control
·Security
·Desktop
·Web
·BSD
·Solaris
·GIAGD
·REALbasic
·All Categories


SQLite Autoincrement
Topic: Database   Posted:2006-08-19
Printer Friendly: Print

spacer
An autoincrement field is already included with SQLite. Select ROWID from a table to get the unique row identification. Here is some REALBasic code that selects the ROWID along with the other columns in the table and displays it in a ListBox:

UtilSet.LBAP.DeleteAllRows
db= New REALSQLdatabase
dbFile = GetFolderItem("mcj.rsd")
db.DatabaseFile=dbFile
If db.Connect() then
rs = db.SQLSelect("select *,ROWID from people")
While Not rs.eof
UtilSet.LBAP.AddRow rs.IdxField(3).StringValue
UtilSet.LBAP.Cell(UtilSet.LBAP.LastIndex, 1)=rs.IdxField(2).StringValue
UtilSet.LBAP.Cell(UtilSet.LBAP.LastIndex, 2)=rs.IdxField(1).StringValue
UtilSet.LBAP.Cell(UtilSet.LBAP.LastIndex, 3)=rs.IdxField(4).StringValue
rs.MoveNext
Wend
else
Beep
MsgBox "The database couldn't be opened."
end if
db.Close

Here is what the output looks like:



For more information, see this SQLite Autoincrement reference page.




Please read our Terms of Use
Microsoft, Windows, Windows XP, Windows 2003, Windows 2000, and NT are either trademarks or registered trademarks of Microsoft Corporation. NetAdminTools.com is not affiliated with Microsoft Corporation. Linux is a registered trademark of Linus Torvalds, and refers to the Linux kernel. The operating system of most distributions that contain the Linux kernel is GNU/Linux. All logos and trademarks in this site are property of their respective owner. Copyright 1997-2008 NetAdminTools.com

Created by:
MCJ
MCJ CMS