Message 1 of 4
Database Saveas and system access error?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report
I'm running some code that copies files and then edits the databases. I've done this a lot at my other job but for some reason at my new one all attempts to save databases fail, every time.
first I copy in the files:
For Each suggestedFile In SuggestedNewFiles
If Not String.IsNullOrWhiteSpace(suggestedFile) Then
Dim newFileLocation = IO.Path.Combine(newFolderLocation, suggestedFile)
If IO.File.Exists(newFileLocation) Then
Dim result = MsgBox("File already exists: " + newFileLocation + vbCrLf + "Do you want to overwrite it?", MsgBoxStyle.YesNo)
If result = MsgBoxResult.No Then
Exit Sub
End If
End If
'Create the new file with the template
IO.File.Copy(Statics.LayoutTemplateFile, newFileLocation, True)
If Not IO.File.Exists(newFileLocation) Then
MsgBox(String.Format("Failed to create file: {0}", suggestedFile), MsgBoxStyle.OkOnly)
Exit Sub
End If
End If
Next
then I open the database and while I can work I cannot save the file
For Each suggestedFile In SuggestedNewFiles
Dim newFileLocation = IO.Path.Combine(newFolderLocation, suggestedFile)
Dim TitleblockLocation As String = ""
TitleblockLocation = GetTitleblockLocation(newFolderLocation)
Using sectionLayoutsDb As Database = New Database(False, True)
sectionLayoutsDb.ReadDwgFile(NewFilename, System.IO.FileShare.ReadWrite, True, "")
If sectionLayoutsDb Is Nothing Then
Exit Sub
End If
HostApplicationServices.WorkingDatabase = thisDb
'''working code here
sectionLayoutsDb.SaveAs(newFileLocation, DwgVersion.Current)
sectionLayoutsDb.CloseInput(True)
End Using
Next
No matter where I put the saveas it complains.