Professional Web Applications Themes

HELP PLEASE - adox ASP vbScript trying to add column and index - ASP Database

Can anyone tell my why I'm getting the following error, please, and recommend how to fix? Microsoft JET Database Engine error '80040e11' Invalid field definition 'ID_subtype' in definition of index or relationship SEE DOWN BELOW WHERE I SAY "ERROR IS HERE" [clip] set objColumn = server.CreateObject("ADOX.Column") if (left(s_new_field_name,2)="ID") then set objIndex = server.CreateObject("ADOX.Index") objColumn.Name = s_new_field_name objColumn.Type = s_new_field_type if (s_new_field_size<>"") then objColumn.DefinedSize = s_new_field_size set objColumn.ParentCatalog=Cat ' must set before setting properties if (s_new_field_default_value<>"") then objColumn.properties("Default")=s_new_field_defaul t_value if (s_new_field_type <> adBoolean) then if (s_new_field_null_ok=true) then objColumn.properties("Nullable")=s_new_field_null_ ok end if 'ERROR DOWN HERE if (left(s_new_field_name,2)="ID") then objIndex.NAME = "myindex" objIndex.Unique ...

  1. #1

    Default HELP PLEASE - adox ASP vbScript trying to add column and index

    Can anyone tell my why I'm getting the following error, please, and
    recommend how to fix?

    Microsoft JET Database Engine error '80040e11'
    Invalid field definition 'ID_subtype' in definition of index or relationship

    SEE DOWN BELOW WHERE I SAY "ERROR IS HERE"

    [clip]

    set objColumn = server.CreateObject("ADOX.Column")
    if (left(s_new_field_name,2)="ID") then set objIndex =
    server.CreateObject("ADOX.Index")
    objColumn.Name = s_new_field_name
    objColumn.Type = s_new_field_type
    if (s_new_field_size<>"") then objColumn.DefinedSize = s_new_field_size
    set objColumn.ParentCatalog=Cat ' must set before setting properties
    if (s_new_field_default_value<>"") then
    objColumn.properties("Default")=s_new_field_defaul t_value
    if (s_new_field_type <> adBoolean) then
    if (s_new_field_null_ok=true) then
    objColumn.properties("Nullable")=s_new_field_null_ ok
    end if

    'ERROR DOWN HERE
    if (left(s_new_field_name,2)="ID") then
    objIndex.NAME = "myindex"
    objIndex.Unique = false
    objIndex.PrimaryKey = false
    objIndex.COLUMNS.APPEND(s_new_field_name)
    objTable.INDEXES.APPEND(objIndex) '<<=== ERROR IS HERE
    end if

    '.properties("Autoincrement")=true
    objTable.Columns.Append objColumn
    set objColumn=nothing

    [clip]

    THANKS!
    --
    Scotter


    Scotter Guest

  2. #2

    Default change to code = NEW ERROR

    I moved my index-adding to below "objTable.Columns.Append objColumn"
    Now the error I get is:
    "Index or primary key cannot contain a Null value"

    SEE DOWN BELOW WHERE I SAY "ERROR IS HERE"

    [clip]

    set objColumn = server.CreateObject("ADOX.Column")
    if (left(s_new_field_name,2)="ID") then set objIndex =
    server.CreateObject("ADOX.Index")
    objColumn.Name = s_new_field_name
    objColumn.Type = s_new_field_type
    if (s_new_field_size<>"") then objColumn.DefinedSize = s_new_field_size
    'if (s_new_field_required<>"") then objColumn.Properties("Nullable") = true
    'if (s_new_field_required<>"") then
    objColumn.attributes=s_new_field_required
    set objColumn.ParentCatalog=Cat ' must set before setting properties
    if (s_new_field_default_value<>"") then
    objColumn.properties("Default")=s_new_field_defaul t_value
    if (s_new_field_type <> adBoolean) then
    if (s_new_field_null_ok=true) then
    objColumn.properties("Nullable")=s_new_field_null_ ok
    end if

    '.properties("Autoincrement")=true
    objTable.Columns.Append objColumn

    if (left(s_new_field_name,2)="ID") then
    objIndex.NAME = s_new_field_name & "_index"
    objIndex.COLUMNS.APPEND(s_new_field_name)
    objIndex.PrimaryKey = false
    objIndex.Unique = false
    objTable.INDEXES.APPEND(objIndex) ' <<<<< ERROR IS HERE
    end if

    set objColumn=nothing
    set objIndex=nothing



    "Scotter" <com> wrote in message
    news:OZV4d.4824$texas.rr.com... 


    Scotter Guest

  3. #3

    Default RE: change to code = NEW ERROR

    Hi Scotter,

    I have replied to you on another thread in
    microsoft.public.vb.database.ado. Please check it. Thanks!

    Kevin Yu
    =======
    "This posting is provided "AS IS" with no warranties, and confers no
    rights."

    Kevin Guest

Similar Threads

  1. Get clicked column index
    By Marcin Gorzynski in forum ASP.NET Data Grid Control
    Replies: 0
    Last Post: September 29th, 10:34 AM
  2. How do I find the index of a DG column with a specific name?
    By Aaron in forum ASP.NET Data Grid Control
    Replies: 4
    Last Post: August 17th, 03:34 PM
  3. adox asp ms access delete a column from a table
    By Scotter in forum ASP Database
    Replies: 2
    Last Post: July 9th, 06:38 AM
  4. Index on Computed Column and ADO Insert
    By Peter Crickman in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: July 4th, 01:46 AM
  5. Which is the best column to insert index...
    By fabriZio in forum Microsoft SQL / MS SQL Server
    Replies: 0
    Last Post: June 30th, 02:37 PM

Bookmarks

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139