I want to create the next generation of Easy4Sales in B4X (currently VB.Net) Easy4Sales is a tool for sales managers that creates reports and overviews.
A database holds all the data. Data is imported via SAP Odata queries. The downloaded Json files can be huge!
A download procedure based on Httpjob gives an out of memory error when I import one fiscal year. I read on the forum that in such cases I have to send several OData requests instead of one, but that is not what I want, since in VB.Net is works perfect. Can someone give me some hints how I can convert the following vb.net snippet to B4X?
Thanks in advance
A database holds all the data. Data is imported via SAP Odata queries. The downloaded Json files can be huge!
A download procedure based on Httpjob gives an out of memory error when I import one fiscal year. I read on the forum that in such cases I have to send several OData requests instead of one, but that is not what I want, since in VB.Net is works perfect. Can someone give me some hints how I can convert the following vb.net snippet to B4X?
Thanks in advance
B4X:
Dim buffer(4096) As Byte
Dim request As WebRequest
request = WebRequest.Create(odataquerysales)
request.Credentials = New NetworkCredential("username", "password")
request.Timeout = 300000
Dim response As WebResponse = request.GetResponse()
Dim bytesRead As Integer
Dim totalBytesRead As Long
Dim bytesToDownload As Long = response.ContentLength
Using dataStream As Stream = response.GetResponseStream()
Using fs As New FileStream("c:\myfile.json", FileMode.Create)
Do
bytesRead = dataStream.Read(buffer, 0, buffer.Length)
totalBytesRead += bytesRead
If bytesRead > 0 Then
fs.Write(buffer, 0, bytesRead)
End If
Loop While bytesRead > 0
End Using
End Using