Skip to content
David Kittell
David Kittell

Application & System: Development / Integration / Orchestration

  • Services
    • Application Development
    • Online Application Integration
  • Code
  • Online Tools
  • Tech Support
David Kittell

Application & System: Development / Integration / Orchestration

Create SQLite Database With Auto Increment

Posted on September 27, 2013December 30, 2015 By David Kittell
Sub CreateTable(SQL As SQL, TableName As String, FieldsAndTypes As Map, PrimaryKey As String, Auto As Boolean)
   Dim sb As StringBuilder
   sb.Initialize
   sb.Append("(")
   For i = 0 To FieldsAndTypes.Size - 1
      Dim field, ftype As String
      field = FieldsAndTypes.GetKeyAt(i)
      ftype = FieldsAndTypes.GetValueAt(i)
      If i > 0 Then sb.Append(", ")
      sb.Append("[").Append(field).Append("] ").Append(ftype)
      'If field = PrimaryKey Then sb.Append(" PRIMARY KEY") 'Original line changed below
      If field = PrimaryKey Then
         sb.Append(" PRIMARY KEY")
         If Auto = True Then sb.Append(" AUTOINCREMENT")
      End If
   Next
   sb.Append(")")
   Dim query As String
   query = "CREATE TABLE IF NOT EXISTS [" & TableName & "] " & sb.ToString
   Log("CreateTable: " & query)
   SQL.ExecNonQuery(query)
End Sub

Source: Billy047 @ http://www.basic4ppc.com/android/forum/threads/dbutils-android-databases-are-now-simple.8475/page-2

Originally Posted on September 27, 2013
Last Updated on December 30, 2015
All information on this site is shared with the intention to help. Before any source code or program is ran on a production (non-development) system it is suggested you test it and fully understand what it is doing not just what it appears it is doing. I accept no responsibility for any damage you may do with this code.

Related

Basic4Android Code SQL SQLite

Post navigation

Previous post
Next post

Related Posts

Provider Detail With Address

Posted on September 16, 2013October 26, 2015

SELECT firstname ,lastname ,prov_nbr ,npi ,address1 ,city ,STATE ,zip FROM provider ,address WHERE addr_who = ‘P ‘ || prov_nbr AND ymdeff <= to_char(sysdate, ‘yyyymmdd’) AND ymdend >= to_char(sysdate, ‘yyyymmdd’) AND void <> ‘Y’ AND substr(addrtype_who, 1, 1) = ‘D’ AND prov_nbr = ‘<Provider Number>’; Originally Posted on September 16, 2013Last…

Read More

Ubuntu / Raspberry Pi – Install NGINX Load Balance DNS

Posted on February 20, 2018

sudo apt install nginx Replace the IP addresses with your IP addresses sudo cp /etc/nginx/nginx.conf /etc/nginx/nginx.conf-original sudo sed -i "/^\s*#/d;s/\s*#[^\"’]*$//" /etc/nginx/nginx.conf && sudo sed -i ‘/^\s*$/d’ /etc/nginx/nginx.conf Modify your config file to look like this user www-data; worker_processes auto; pid /run/nginx.pid; include /etc/nginx/modules-enabled/*.conf; events { worker_connections 768; } http {…

Read More

DNN – Rename Admin User

Posted on May 4, 2015October 26, 2015

SET NOCOUNT ON DECLARE @OldUsername nvarchar(100), @NewUsername nvarchar(100) SET @OldUsername = ‘dkittell1’ SET @NewUsername = ‘dkittell’ UPDATE dnn_Users SET [Username] = @NewUsername WHERE [Username] = @OldUsername; UPDATE aspnet_Users SET [LoweredUserName] = @NewUsername WHERE [LoweredUserName] = @OldUsername; UPDATE aspnet_Users SET [UserName] = @NewUsername WHERE [UserName] = @OldUsername; UPDATE dnn_EventLog SET [LogUserName]…

Read More

Code

Top Posts & Pages

  • PowerShell - Rename Pictures to Image Taken
  • Front Page
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions

Recent Posts

  • Javascript – Digital Clock with Style
  • BASH – Web Ping Log
  • BASH – Picture / Video File Name Manipulation
  • Mac OSX Terminal – Create SSH Key
  • Bash – Rename Picture

Top Posts

  • PowerShell - Rename Pictures to Image Taken
  • C# - Start/Stop/Restart Services
  • MacPorts / HomeBrew - Rip CD tracks from terminal
  • PowerShell - Show File Extensions
  • Open On Screen Keyboard (OSK)
  • SQLite - Auto-Increment / Auto Generate GUID
©2025 David Kittell | WordPress Theme by SuperbThemes