Dim SQLVariables As SQL 'in Process_Globals
Dim Cursor1 As Cursor 'in Globals
If File.Exists(File.DirDefaultExternal,"l4pro.sql") = False Then
File.Copy(File.DirAssets,"l4pro.sql",File.DirDefaultExternal,"l4pro.sql")
End If
If SQLVariables.IsInitialized = False Then
SQLVariables.Initialize(File.DirDefaultExternal, "l4pro.sql", False)
End If
Dim MyTable As String = "names" 'Put your table name here
Dim txt As String
txt="SELECT * FROM " & MyTable & " LIMIT 1"
Cursor1=SQLVariables.ExecQuery(txt)
Cursor1.Position=0
Dim cols As Int = Cursor1.ColumnCount
Dim MyColName(cols) As String
Dim NewColumn As String = "Col10"
Dim Flag As Boolean =False
For i=0 To Cursor1.ColumnCount-1
MyColName(i)=Cursor1.GetColumnName(i)
If MyColName(i)= NewColumn Then
Msgbox("Column already exists. ","")
Flag=True
Exit
End If
Next
If Flag=False Then
txt="ALTER TABLE " & MyTable & " ADD COLUMN " & NewColumn & " VARCHAR(100)"
SQLVariables.ExecNonQuery(txt)
Msgbox(NewColumn & " was added to the table","")
End If