Tek-Tips is the largest IT community on the Internet today!

Members share and learn making Tek-Tips Forums the best source of peer-reviewed technical information on the Internet!

  • Congratulations SkipVought on being selected by the Tek-Tips community for having the most helpful posts in the forums last week. Way to Go!

Problem in ADOX

Status
Not open for further replies.

sbind77

Programmer
Oct 2, 2001
29
0
0
US

Hi Every one
The Following is my code.It was working fine till yesterday, but the
same code gives error now.I don't know how to fix this.
I will appreciate if any one help me to come out of this problem.

Error Description

Error Type:
ADOX.Tables (0x800A0CC1)
Item cannot be found in the collection corresponding to the requested
name or ordinal.
/dcpsc/edkt/demo/dckt_create.asp, line 52

My Code:


set objconn=Server.CreateObject("ADODB.Connection")

DSNtemp="FILEDSN=c:\InetPub\pscweb\psc1.dsn"
objconn.open DSNtemp


Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
Set objADOXDatabase.ActiveConnection = objconn

STR1=REQUEST("caseno")

str_flag="N"

For Each objTable in objADOXDatabase.Tables
if lCase(left(objTable.Name,2)) = "fc" then
if Trim(objTable.Name)=str1 then
str_flag="Y"
exit for
end if
end if
Next

if str_flag="N" then
objconn.Execute("CREATE TABLE " & str1)
objconn.Execute("ALTER TABLE " & str1 &" ADD COLUMN DOCKETNO VARCHAR
[50]")
objconn.Execute("ALTER TABLE " & str1 &" ADD COLUMN [DATE] varchar
[50] ")
end if


str_flag1="N"

--------------------------------------------------
#####-- Error pOint----####
------------------------------------------------------

For Each objTable in objADOXDatabase.Tables(str1).Columns '###Err Ln##
if Trim(objTable.Name)="StoredFileName" then
str_flag1="Y"
end if
next


Thanks
Balachandar


Thank You
sbind77
 
I had the same error with a recordset.
I forgot to call an element of my table in my SELECT.

So your problem is the element you call :
- doesn't exist in your table.
- is not reachable.
I hope it helps you.
--
X-) Split.
 
You're probably creating a new table - then your code is trying to iterate through the columns in the new table. The problem is that you've added the table, but the collection of tables that you have, objADOXDatabase, has not been updated as well. In the if statement that creates the new table, recreate the collection:

if str_flag="N" then
objconn.Execute("CREATE TABLE " & str1)
objconn.Execute("ALTER TABLE " & str1 &" ADD COLUMN DOCKETNO VARCHAR[50]")
objconn.Execute("ALTER TABLE " & str1 &" ADD COLUMN [DATE] varchar[50] ")

Set objADOXDatabase = Nothing
Set objADOXDatabase = Server.CreateObject("ADOX.Catalog")
Set objADOXDatabase.ActiveConnection = objconn
end if

I don't know if the catalog object has a refresh method. If it does you could try that too.

Hope this helps. -Chris Didion
Matrix Automation, MCP
 
Status
Not open for further replies.

Part and Inventory Search

Sponsor

Back
Top