Quote:
quote:Originally posted by Imar
What kind of modifications are you making? Maybe you can post some code so I can take a look at it......
|
Well, I've taken out just about everything that I added and it still crashes with that error, just at a later point in the processing now. Here's what's in the ASP. I've omitted routine html that comes before and after this, and I've changed the path to "path" to help protect the guilty.
When it's in a good mood it crashes somewhere after the line
Response.Write "<p>Have done the Appends. Now set the adColNullables.</p>"
If I try running it again after that crash (with a different database, because now there's alocked version of the first one in the directory), then it crashes much earlier, at the line:
.Type = adInteger
The ASP:
<%
Dim pagename, dox_folder, dbfilename_execdirs, dbfilename_public, dbname_execdirs, dbname_public
pagename = "filter-main2public.asp" ' change these when renaming the page, etc
dox_folder = "d:\path\dox\"
dbfilename_execdirs = "execdirs.xls"
dbfilename_public = "MembersPublic.mdb"
dbname_execdirs = dox_folder & dbfilename_execdir
dbname_public = dox_folder & dbfilename_public
' create new database
Sub CreateAccessDatabase(sDatabaseToCreate)
Dim catNewDB ' As ADOX.Catalog
Set catNewDB = Server.CreateObject("ADOX.Catalog")
catNewDB.Create "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDatabaseToCreate & _
";Jet OLEDB:Engine Type=5;"
' Engine Type=5 = Access 2000 Database
' Engine Type=4 = Access 97 Database
Set catNewDB = Nothing
End Sub
' create table in database
Sub CreateAccessTable(sDatabaseToCreate)
' Dim tblName
' tblName = "Members"
Dim catDB ' As ADOX.Catalog
Set catDB = Server.CreateObject("ADOX.Catalog")
' Open the catalog
catDB.ActiveConnection = "Provider=Microsoft.Jet.OLEDB.4.0;" & _
"Data Source=" & sDatabaseToCreate
Dim tblNew ' As ADOX.Table
Set tblNew = Server.CreateObject("ADOX.Table")
' tblNew.Name = tblName
tblNew.Name = "Members"
Response.Write "<p>will now create the autonumber column</p>"
' First Create an Autonumber column, called WebID.
' This is just for demonstration purposes.
' We could have done this below with all the other columns as well
Dim col ' As ADOX.Column
Set col = Server.CreateObject("ADOX.Column")
Response.Write "<p>Created the ADOX.Column object 'col'</p>"
With col
.ParentCatalog = catDB
Response.Write "<p>Assigned the ParentCatalog property</p>"
Response.Write "<p>adInteger = " & adInteger & "</p>"
.Type = adInteger
Response.Write "<p>Assigned the Type</p>"
.Name = "WebID"
Response.Write "<p>Assigned the Name</p>"
.Properties("Autoincrement") = True
End With
Response.Write "<p>Have done the assignments, now do the Append method</p>"
tblNew.Columns.Append col
Response.Write "<p>will now create the other columns</p>"
' Now add the rest of the columns
With tblNew
' Create fields and append them to the
' Columns collection of the new Table object.
With .Columns
.Append "Execdir_ID", adInteger
.Append "LastName", adVarWChar
.Append "Suffix", adVarWChar
.Append "FirstName", adVarWChar
.Append "MembershipClass", adVarWChar
.Append "HomePage", adVarWChar
.Append "SFFNet_Newsgroup", adVarWChar
.Append "Blog", adVarWChar
.Append "BFOB", adVarWChar
.Append "Calendar", adVarWChar
End With
Response.Write "<p>Have done the Appends. Now set the adColNullables.</p>"
Dim adColNullable, adColFixed ' Is not defined in adovbs.inc,
' so we need to define it here.
' The other option is adColFixed (ie: required field) with a value of 1
adColFixed = 1
adColNullable = 2
.Columns("WebID").Attributes = adColFixed
.Columns("Execdir_ID").Attributes = adColFixed
.Columns("LastName").Attributes = adColFixed
.Columns("Suffix").Attributes = adColNullable
.Columns("FirstName").Attributes = adColNullable
.Columns("MembershipClass").Attributes = adColNullable
.Columns("HomePage").Attributes = adColNullable
.Columns("SFFNet_Newsgroup").Attributes = adColNullable
.Columns("Blog").Attributes = adColNullable
.Columns("BFOB").Attributes = adColNullable
.Columns("Calendar").Attributes = adColNullable
End With
' Add the new Table to the Tables collection of the database.
catDB.Tables.Append tblNew
Set col = Nothing
Set tblNew = Nothing
Set catDB = Nothing
End Sub
' ***** ACTUAL PROGRAM EXECUTION STARTS HERE *****
' First check if database exists, and rename it if it does
'Dim objFSO, objFolder, objFile
'Set objFSO = CreateObject("Scripting.FileSystemObject")
'Set objFolder = objFSO.GetFolder(dox_folder)
'For Each objFile in objFolder.Files
' If objFile.Name = "MembersPubOld.mdb" Then
' Response.Write "<p>deleting MembersPubOld.mdb</p>"
' objFile.Delete
' End If
'Next
'For Each objFile in objFolder.Files
' If objFile.Name = "MembersPublic.mdb" Then
' Response.Write "<p>renaming (moving) MembersPublic.mdb</p>"
' objFile.Move "MembersPubOld.mdb"
' End If
'Next
'Set objFSO = nothing
'Set objFolder = nothing
'Set objFile = nothing
' First call the Create Database method
Response.Write "<p>Calling the Create Database routine</p>"
CreateAccessDatabase dbname_public
' Then add a table and columns to this database
Response.Write "<p>Calling the Create Table routine</p>"
CreateAccessTable dbname_public
Response.Write "Database has been created successfully!"
%>