Dim ZipToUnpack As String = fullzippath
Dim TargetDir As String = Server.MapPath("uploads/")
Dim ez As ZipEntry
Using zip1 As ZipFile = ZipFile.Read(ZipToUnpack)
' based on entry name, size, date, etc.
For Each ez In zip1
ez.Extract(TargetDir, ExtractExistingFileAction.OverwriteSilently)
' Once extracted, let us know
dvResults.InnerHtml &= "<br />File <b>" & ez.FileName & "</b> has been extracted and uploaded." ' & TargetDir
' Open the file, using a streamreader
Dim objSR As StreamReader = File.OpenText(TargetDir & ez.FileName)
' Read the file's contents into a variable
Dim contents As String = objSR.ReadToEnd()
' Start: write Biodata CROSSREF to table
If ez.FileName.Contains("Cross") Then
' the array of rows
Dim arrRows() As String = contents.Split(vbCrLf) 'contents.Split("|" + vbCrLf)
Dim arrCells() As String
' Loop through its contents
For Each a As Object In arrRows
Dim tbl As New Object
tbl = New tblBiodata_Cross_Reference_TEMP
dcMeheret.ExecuteCommand("Truncate table tblBiodata_Cross_Reference_TEMP")
' If a line doesn't have |, then skip it
If a.Contains("GUID") Then Continue For
' Split each row into the 3 columns
arrCells = a.Split("|")
' Add each cell into the linq table row
With tbl
.Row = arrCells(0)
.Case_GUIDFrom = New Guid(arrCells(1))
.FullCaseNoFrom = arrCells(2)
End With
dcMeheret.tblBiodata_Cross_Reference_TEMPs.InsertOnSubmit(tbl)
Next
End If
' End: write Biodata CROSSREF to table
' *** End: write biotable to respective tables. ***
' Close the streamreader
objSR.Close()
Next
' Save changes
dcMeheret.SubmitChanges()
End Sub
Experts Exchange always has the answer, or at the least points me in the correct direction! It is like having another employee that is extremely experienced.
When asked, what has been your best career decision?
Deciding to stick with EE.
Being involved with EE helped me to grow personally and professionally.
Connect with Certified Experts to gain insight and support on specific technology challenges including:
We've partnered with two important charities to provide clean water and computer science education to those who need it most. READ MORE