Ok, coming over from VB6 to VB.net and now joining the B4a community (hello to you all), I have come a cropper and its probably something stupid.
Ok, I have my main module, an additional module with some declarations.
My main module calls OpenConnection and then calls CreateDB sub.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL1 As SQL
End Sub
Sub OpenConnection
SQL1.Initialize(File.DirDefaultExternal, "Wedman.db", True)
End Sub
sub CreateDB
dim SQLStr as string
SQLStr = "CREATE TABLE [Clients] ("
SQLStr = SQLStr & "[ID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT"
SQLStr = SQLStr & ",[Surname] TEXT NULL)"
SQL1.BeginTransaction
SQL1.ExecQuery(SQLStr)
SQL1.TransactionSuccessful
SQL1.EndTransaction
SQL1.BeginTransaction
SQLStr = "CREATE INDEX IX_INDEXID ON [Clients] ([ID])"
SQL1.ExecNonQuery(SQLStr)
SQL1.TransactionSuccessful
SQL1.EndTransaction
end sub
I know that my SQL code is ok as I have the same code running in a vb.net app.
I get no exception on creating the table, but when I try to create the index (or even just do an INSERT) I get an error of table "Clients" does not exist.
Please point out the blindingly obvious to me, thanks
Carl
Ok, I have my main module, an additional module with some declarations.
My main module calls OpenConnection and then calls CreateDB sub.
Sub Process_Globals
'These global variables will be declared once when the application starts.
'These variables can be accessed from all modules.
Dim SQL1 As SQL
End Sub
Sub OpenConnection
SQL1.Initialize(File.DirDefaultExternal, "Wedman.db", True)
End Sub
sub CreateDB
dim SQLStr as string
SQLStr = "CREATE TABLE [Clients] ("
SQLStr = SQLStr & "[ID] INTEGER NOT NULL PRIMARY KEY AUTOINCREMENT"
SQLStr = SQLStr & ",[Surname] TEXT NULL)"
SQL1.BeginTransaction
SQL1.ExecQuery(SQLStr)
SQL1.TransactionSuccessful
SQL1.EndTransaction
SQL1.BeginTransaction
SQLStr = "CREATE INDEX IX_INDEXID ON [Clients] ([ID])"
SQL1.ExecNonQuery(SQLStr)
SQL1.TransactionSuccessful
SQL1.EndTransaction
end sub
I know that my SQL code is ok as I have the same code running in a vb.net app.
I get no exception on creating the table, but when I try to create the index (or even just do an INSERT) I get an error of table "Clients" does not exist.
Please point out the blindingly obvious to me, thanks
Carl