CreateTable

Method
Creates a database table.

Category
Database

 

Syntax
Function CreateTable(hCreateTable As Long) As Boolean

hCreateTable
A create table handle.

 

Example

'Case "CreateTable"

  'Creates table Number from Parameter1 and Name from Parameter2

  CF1.CreateTableBegin hTable, CLng(.Text1(cf.TableNoCreate)), .Text1(cf.TableNameCreate), 1

  logWr "CreateTableBegin: " + Str(hTable)

  CF1.AddTableField hTable, 1, "Felt1", 7, 2, "", 0

  CF1.AddTableField hTable, 2, "Felt2", 7, 2, "", 0

  'Adding Key

  IntArray(0) = 1

  IntArray(1) = 2

  IntArray(2) = 0

  KeyArray = IntArray

  CF1.AddKey hTable, KeyArray, KeyArray

  logWr "Addkey result: OK"

  tmpVar = CF1.CreateTable(hTable)

  If VarType(tmpVar) = vbBoolean And tmpVar = True Then

  logWr "CreateTable result: OK"

  Else

  logWr "CreateTable result: Failed"

  End If

  CF1.CreateTableEnd hTable

 

Comments
CreateTable creates a table in a Navision database. Before using CreateTable you have to acquire a create table handle by using CreateTableBegin, and add fields and keys with AddTableField and AddKey.

CreateTable returns TRUE if the table is created successfully and FALSE if it is not created. If creating the table fails, the error handler is called.

If you use CreateTableEnd without using CreateTable, the table will not be created.



© 2009 Microsoft Corporation. All rights reserved.