AnsweredAssumed Answered

Library Database readonly

Question asked by mans.joling on Nov 9, 2011
Latest reply on Nov 9, 2011 by mans.joling

Hello,

 

I have this source in visual basic 2010

The goal is to change property values (about 6400)

When I run this I get the error database is readonly on this line => PartsProp.Value = p1.uploadFITFile(I).FITL20SS

 

 

 

 

 

 

 

Any idea?

 

Public Sub Update_FitValues_MGC_Library()

libfile =

 

New FileInfo("D:\GV2007-9\GV2007-9.lmc")

PE =

 

New MGCPCBPartsEditor.PartsEditorDlg()

PE.OpenDatabase(libfile.FullName,

 

False)

ChangeFitRateValuesInLibrary(PE)

PE.CloseActiveDatabase()

 

End
Sub

 

End
Sub

End

Sub

 

Sub

 

Sub

Sub

 

 

 

 

 

Public Sub ChangeFitRateValuesInLibrary(ByVal PartsEditorDialog As MGCPCBPartsEditor.IMGCPDBPartsEditorDlg)

 

 

Dim PartsDb As IMGCPDBPartsDB

 

 

Dim Partition As MGCPCBPartsEditor.IMGCPDBPartition

 

 

Dim Partitions As MGCPCBPartsEditor.IMGCPDBPartitions

 

 

Dim Part As MGCPCBPartsEditor.IMGCPDBPart

 

 

Dim PartIndex As Integer = 0

 

 

Dim PartsProp As MGCPCBPartsEditor.IMGCPDBProperty

 

 

Dim words() As String

 

 

Dim Line As String = String.Empty

 

 

Dim Partnumber As String = String.Empty

 

 

Dim Line2 As String = String.Empty

 

 

Dim I As Int32

p1.uploadFITFile = p1.GetNewMtbfDataTableFromExcel()

PartsDb = PartsEditorDialog.ActiveDatabaseEx

Partitions = PartsDb.Partitions

 

 

For Each Partition In Partitions

 

 

If (StrComp(Partition.Name, "El-holes") <> 0) And (StrComp(Partition.Name, "Enginering") <> 0) And _

(StrComp(Partition.Name,

 

"ForbiddenNeols") <> 0) And (StrComp(Partition.Name, "Hardware") <> 0) And _

(StrComp(Partition.Name,

 

"MaintNfade-out") <> 0) And (StrComp(Partition.Name, "Unqiue") <> 0) And _

(StrComp(Partition.Name,

 

"Unreleased") <> 0) And (StrComp(Partition.Name, "Sensoren") <> 0) Then

 

 

For Each Part In Partition.Parts

 

 

For I = 0 To p1.uploadFITFile.Count - 1

 

 

If (StrComp(Part.Number, p1.uploadFITFile(I).Futype) = 0) Then

 

 

If (InStr(UCase(Part.Label), "NO DISPEN") > 0) Or (Len(Part.Label) <= 0) Then

 

 

If MessageBox.Show("No Dispensation found or partlabel is empty (exit)", _

 

 

"Code number exists in partlabel?", MessageBoxButtons.OK) = DialogResult.OK Then

 

 

Exit Sub

 

 

End If

 

 

End If

words = Part.Label.Split(

 

" ".ToCharArray(), StringSplitOptions.RemoveEmptyEntries)

 

 

If words.Length < 5 Then

 

 

If MessageBox.Show("Unexpected partlabel (exit)", _

 

 

"Undefined partlabel structure?", MessageBoxButtons.OK) = DialogResult.OK Then

 

 

Exit Sub

 

 

End If

 

 

End If

 

 

For Each PartsProp In Part.Properties

 

 

If InStr(PartsProp.Name, "FIT-L-20EL") > 0 Then

PartsProp.Value = p1.uploadFITFile(I).FITL20EL

 

 

End If

 

 

If InStr(PartsProp.Name, "FIT-L-20SS") > 0 Then

PartsProp.Value = p1.uploadFITFile(I).FITL20SS

 

 

End If

 

 

If InStr(PartsProp.Name, "FIT-L-80EL") > 0 Then

PartsProp.Value = p1.uploadFITFile(I).FITL80EL

 

 

End If

 

 

If InStr(PartsProp.Name, "FIT-L-80SS") > 0 Then

PartsProp.Value = p1.uploadFITFile(I).FITL80SS

 

 

End If

 

 

Next

 

 

End If

 

 

Next

 

 

Next

 

 

End If

 

 

 

 

 

Next

 

 

 

End Sub

 

 

 

 

 

Next

 

 

 

End Sub

 

 

 

 

 

Next

 

 

 

End Sub

 

 

 

 

Next

 

 

 

End Sub

 

 

 

 

Next

 

 

 

End Sub

 

 

 

 

Next

 

 

 

End Sub

 

 

 

 

Next

 

 

 

End Sub

 

Outcomes