Problems with Dictionary Object

Results 1 to 3 of 3

Thread: Problems with Dictionary Object

  1. #1
    Join Date
    Dec 1969

    Default Problems with Dictionary Object

    Hi,<BR><BR>i want to use the dictionary object to save some information abount the fields of a table. unfortunately the following does not work:<BR><BR>sub getStructure<BR>dim objRS<BR>dim delimiter<BR>dim x <BR>set x = CreateObject("Scripting.Dictionary")<BR> sql = "exec sp_columns @table_name=&#039" & tablename & "&#039" <BR> set objRS = objConn.execute(sql) <BR> while not objRS.eof<BR> if objRS("DATA_TYPE") = -9 or objRS("DATA_TYPE") = 12 then <BR> delimiter = "&#039"<BR> else<BR> delimiter = ""<BR> end if<BR> x.Add objRS("COLUMN_NAME"),delimiter & request(objRS("COLUMN_NAME")) & delimiter<BR> objRS.movenext<BR> wend<BR> objRS.close<BR> set objRS = nothing<BR>end sub<BR><BR>i get an error message telling me that such a key is already there but every field of the table has a different name so that can not be.

  2. #2
    Join Date
    Dec 1969

    Default RE: Problems with Dictionary Object

    I would double check that there isnt any duplicate field values. Run the following sql statement.<BR><BR>SELECT column_name FROM your_table GROUP BY column_name HAVING count(column_name) &#062; 1<BR><BR>

  3. #3
    Richard A. Lowe Guest

    Default RE: Problems with Dictionary Object

    Try response.writing out the output of the recordset so you can see exactly why it&#039s complaining...<BR><BR>R.

Posting Permissions

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