K
Kevin
I'm at my wits end on this. Hopefully it's just something stupid I did.
I have a dataset of a that I'm populating by looping through some records in
a Btrieve database (Peachtree) and then writing to a SQL table. New records
load fine and dandy but if the dataset contains any modified records,
updates hang (60 second timeout).
The dataset was created with the wizard in VS05. I've tried putting the
update outside the loop after the end while with the same results.
I've included the code for the sub below
Many thanks in advance
Kevin Vogler
Private Sub getSalesOrderJournal()
Dim ps As New PeachtreeStuff
Dim CurrentPeriod = ps.mwCurrentPeriod()
Dim oSOJournal As PAW.SalesOrderJournal = New PAW.SalesOrderJournal
Me.SalesOrderHeadersTableAdapter.Fill(Me.SalesOrders.SalesOrderHeaders)
Dim Status As Integer
Dim MatchRow As Integer = -1
ps.PeachCon() ' connection to Peachtree Btrieve
Status = oSOJournal.OpenFile()
Dim RangeP As Short = CurrentPeriod
Dim CustomerStatus As Integer = 0
Dim ItemStatus As Integer = 0
Dim row As SalesOrders.SalesOrderHeadersRow
Status = oSOJournal.ReadFirst(RangeP)
While Status = 0
Me.SalesOrders.SalesOrderHeaders.DefaultView.Sort = "NRecord"
MatchRow =
Me.SalesOrders.SalesOrderHeaders.DefaultView.Find(oSOJournal.NRecord)
CustID_SONum = oSOJournal.CustomerIndex.ToString + "_" +
oSOJournal.InvoiceNumber.ToString
If MatchRow = -1 Then
row = Me.SalesOrders.SalesOrderHeaders.NewSalesOrderHeadersRow()
Else
row = Me.SalesOrders.SalesOrderHeaders.Rows(MatchRow)
End If
row("NRecord") = oSOJournal.NRecord
row("SalesOrderNumber") = oSOJournal.InvoiceNumber.ToString
row("CustomerID") = oSOJournal.CustomerIndex.ToString
row("CustID_SONum") = CustID_SONum
row("OrderClosed") = oSOJournal.CloseSalesOrder.ToString
If MatchRow = -1 Then
Me.SalesOrders.SalesOrderHeaders.Rows.Add(row)
End If
Try
Me.SalesOrderHeadersTableAdapter.Update(Me.SalesOrders.SalesOrderHeaders)
Catch ex As Exception
End Try
Status = oSOJournal.ReadNext
row = Nothing
End While
Status = oSOJournal.CloseFile
If Not IsNothing(oSOJournal) Then
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oSOJournal)
oSOJournal = Nothing
ps.PeachDisCon()
ps = Nothing
End Sub
I have a dataset of a that I'm populating by looping through some records in
a Btrieve database (Peachtree) and then writing to a SQL table. New records
load fine and dandy but if the dataset contains any modified records,
updates hang (60 second timeout).
The dataset was created with the wizard in VS05. I've tried putting the
update outside the loop after the end while with the same results.
I've included the code for the sub below
Many thanks in advance
Kevin Vogler
Private Sub getSalesOrderJournal()
Dim ps As New PeachtreeStuff
Dim CurrentPeriod = ps.mwCurrentPeriod()
Dim oSOJournal As PAW.SalesOrderJournal = New PAW.SalesOrderJournal
Me.SalesOrderHeadersTableAdapter.Fill(Me.SalesOrders.SalesOrderHeaders)
Dim Status As Integer
Dim MatchRow As Integer = -1
ps.PeachCon() ' connection to Peachtree Btrieve
Status = oSOJournal.OpenFile()
Dim RangeP As Short = CurrentPeriod
Dim CustomerStatus As Integer = 0
Dim ItemStatus As Integer = 0
Dim row As SalesOrders.SalesOrderHeadersRow
Status = oSOJournal.ReadFirst(RangeP)
While Status = 0
Me.SalesOrders.SalesOrderHeaders.DefaultView.Sort = "NRecord"
MatchRow =
Me.SalesOrders.SalesOrderHeaders.DefaultView.Find(oSOJournal.NRecord)
CustID_SONum = oSOJournal.CustomerIndex.ToString + "_" +
oSOJournal.InvoiceNumber.ToString
If MatchRow = -1 Then
row = Me.SalesOrders.SalesOrderHeaders.NewSalesOrderHeadersRow()
Else
row = Me.SalesOrders.SalesOrderHeaders.Rows(MatchRow)
End If
row("NRecord") = oSOJournal.NRecord
row("SalesOrderNumber") = oSOJournal.InvoiceNumber.ToString
row("CustomerID") = oSOJournal.CustomerIndex.ToString
row("CustID_SONum") = CustID_SONum
row("OrderClosed") = oSOJournal.CloseSalesOrder.ToString
If MatchRow = -1 Then
Me.SalesOrders.SalesOrderHeaders.Rows.Add(row)
End If
Try
Me.SalesOrderHeadersTableAdapter.Update(Me.SalesOrders.SalesOrderHeaders)
Catch ex As Exception
End Try
Status = oSOJournal.ReadNext
row = Nothing
End While
Status = oSOJournal.CloseFile
If Not IsNothing(oSOJournal) Then
System.Runtime.InteropServices.Marshal.FinalReleaseComObject(oSOJournal)
oSOJournal = Nothing
ps.PeachDisCon()
ps = Nothing
End Sub