473,486 Members | 2,181 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Unable to read data from the transport Connection


Hi all,

I've developed a mobile application for windows mobile 5.0 that has
been in use for a while (1 year and a couple of months). It was
developed in visual studios 2005 with a back-end sql server mobile ce
database. Until recently I was synching everything thru a com port
serial cable. The devices would connect to the computer thru
activesync and are able to acquire an internet connection. The sync
for the program occurs thru a website stored locally on my computer
that then places the data in a local Access database.

As I said this has all been working fine, however at the beginning of
the week our server crashed and since its been repaired everytime I
try to upload the data I get Upload Failure: unable to read data from
the transport connection.

Now two of the mobile devices will still upload data intermittenly out
of 16. I've checked the settings on the devices and they are all the
same. They can all access the internet thru pocket explorer when
connected to the computer via the cable. I've checked my code and the
connection timeout is set to 600000 seconds. Please ,please help me
with this issue as I really have a backlog of data piling up on me.

Thank you!

Aug 31 '07 #1
3 2086
Web method file

Imports System.Web
Imports System.Data.OleDb
Imports System.Data
Imports System.Web.Services
Imports System.Web.Services.Protocols

<WebService(Namespace:="http://tempuri.org/")_
<WebServiceBinding(ConformsTo:=WsiProfiles.BasicPr ofile1_1)_
<Global.Microsoft.VisualBasic.CompilerServices.Des ignerGenerated()_
Public Class Access
Inherits System.Web.Services.WebService

<WebMethod()_
Public Function HelloWorld() As String
Return "Hello World"
End Function

<System.Web.Services.WebMethod()_
Public Function GetAccessData(ByVal command As String) As DataSet
Dim dataset As DataSet = Nothing
' Connect to Access DB here, execute command and populate data
set with returned data.

Return dataset

End Function

' UpdateAccessData connects to and access database and inserts the
data tables into the correct locations.
' Parameters: DonorChanges as DataSet. DonorChanges is the dataset
of pick-ups and deliverys.
' Return value: Boolean. Success or failure.
<System.Web.Services.WebMethod()_
Public Function UpdateAccessData(ByVal DonorChanges As DataSet) As
Boolean
Me.Server.ScriptTimeout = 60000000
Dim DonorStartingRows As Integer
Dim AgencyStartingRows As Integer
Dim LinkStartingRows As Integer
'Dim DriverStartingRows As Integer

' Connection string to connect to access database
Dim FHDB As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;Data Source=C:
\testpre\Replica_of_be\Replica_of_harvest2000_be.m db;User
Id=admin;Password=;")

' Table adapter to get information from tables in the database
Dim daFoodDonor As New OleDb.OleDbDataAdapter("select * from
tblFoodDonations", FHDB)
' Data table to store info
Dim FoodDonorTable As New DataTable

' Fill the data table with info
daFoodDonor.Fill(FoodDonorTable)
daFoodDonor.Dispose()
' No longer using this adapter so free memory

DonorStartingRows = FoodDonorTable.Rows.Count

FoodDonorTable.Dispose()

' Find the number of rows we will be inserting
Dim rowsDonor As Integer = DonorChanges.Tables(0).Rows.Count
' insert that number of rows
For rowsCount As Integer = 1 To rowsDonor
Dim addDonorReciepts As New OleDb.OleDbCommand ' Declare
new command
Dim oneRowDon As DataRow =
DonorChanges.Tables(0).Rows.Item((rowsCount - 1)) ' The row to be
inserted
Dim julda As Long = CLng(Format(Year(oneRowDon.Item(8)),
"0000") _
+ Format(DateDiff("d", CDate("01/01/" _
+ Format(Year(oneRowDon.Item(8)), "0000")),
oneRowDon.Item(8)) _
+ 1, "000"))
Dim mt As String =
String.Concat(oneRowDon.Item(9).Hours.ToString, _

oneRowDon.Item(9).Minutes.ToString, _

oneRowDon.Item(9).Seconds.ToString)
Dim uniID As String = String.Concat(julda.ToString,
mt.ToString, oneRowDon.Item(10).ToString)
If oneRowDon.Item(1).Equals("Inventory") Then
DonorStartingRows = DonorStartingRows - 1
Else
With addDonorReciepts
.CommandTimeout = 600000
'insert command
.CommandText = "insert into tblFoodDonations
([Date], [Donor Time], [Bakery], [Meat]," & _
"[Fruit], [Dairy], [Vegetable], [Prepared],
[Juice], [Non-Perishable], [Non-Food]," & _
"[Total Donations], [DonorReceiptId], Driver,
TruckNumber, DonorID, FoodDonationsID)" & _
"values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
.Parameters.Add(New OleDbParameter("Date",
oneRowDon.Item(8).Date))
.Parameters.Add(New OleDbParameter("Time",
oneRowDon.Item(9)))
.Parameters.Add(New OleDbParameter("Bakery",
oneRowDon.Item(12)))
.Parameters.Add(New OleDbParameter("Meat",
oneRowDon.Item(14)))
.Parameters.Add(New OleDbParameter("Fruit",
oneRowDon.Item(15)))
.Parameters.Add(New OleDbParameter("Dairy",
oneRowDon.Item(13)))
.Parameters.Add(New OleDbParameter("Vege",
oneRowDon.Item(16)))
.Parameters.Add(New OleDbParameter("Prep",
oneRowDon.Item(17)))
.Parameters.Add(New OleDbParameter("Juice",
oneRowDon.Item(20)))
.Parameters.Add(New OleDbParameter("NP",
oneRowDon.Item(21)))
.Parameters.Add(New OleDbParameter("NF",
oneRowDon.Item(22)))
.Parameters.Add(New OleDbParameter("Total",
oneRowDon.Item(23)))
.Parameters.Add(New OleDbParameter("ReceiptID",
uniID))
.Parameters.Add(New OleDbParameter("Driver",
oneRowDon.Item(11)))
.Parameters.Add(New OleDbParameter("Truck",
oneRowDon.Item(10)))
.Parameters.Add(New OleDbParameter("DonorID",
oneRowDon.Item(0)))
.Parameters.Add(New OleDbParameter("FoodID",
uniID))
Dim fs As IO.FileStream = New IO.FileStream("C:
\testpre\Signature\Donor\" & uniID & ".bmp", IO.FileMode.Create)
fs.Write(oneRowDon.Item(19), 0,
oneRowDon.Item(19).Length)
fs.Flush()
fs.Close()
.Connection = FHDB ' connection string
.Connection.Open() ' open connection
.ExecuteNonQuery() ' execute command
.Connection.Close() ' close connection
.Dispose() ' free memory
End With
For linkRowNum As Integer = 0 To
DonorChanges.Tables(2).Rows.Count - 1
If
DonorChanges.Tables(2).Rows(linkRowNum).Item(1).Eq uals(oneRowDon.Item(24).ToString)
Then

DonorChanges.Tables(2).Rows(linkRowNum).Item(1) = uniID
End If
Next
End If
Next

Dim daAgencyRec As New OleDb.OleDbDataAdapter("select * from
tblAgencyReceipt", FHDB)
Dim AgencyRecTable As New DataTable

daAgencyRec.Fill(AgencyRecTable)
daAgencyRec.Dispose()

AgencyStartingRows = AgencyRecTable.Rows.Count

AgencyRecTable.Dispose()

' Find the number of rows we will be inserting
Dim rowsAgency As Integer = DonorChanges.Tables(1).Rows.Count
' insert that number of rows
For rowscount As Integer = 1 To rowsAgency
Dim addAgeRec As New OleDb.OleDbCommand ' Declare new
command
Dim oneRowAge As DataRow =
DonorChanges.Tables(1).Rows.Item((rowscount - 1)) ' The row to be
inserted
Dim julda As Long = CLng(Format(Year(oneRowAge.Item(8)),
"0000") _
+ Format(DateDiff("d", CDate("01/01/" _
+ Format(Year(oneRowAge.Item(8)), "0000")),
oneRowAge.Item(8)) _
+ 1, "000"))
Dim mt As String =
String.Concat(oneRowAge.Item(9).Hours.ToString, _

oneRowAge.Item(9).Minutes.ToString, _

oneRowAge.Item(9).Seconds.ToString)
Dim uniID As String = String.Concat(julda.ToString,
mt.ToString, oneRowAge.Item(10).ToString)
If oneRowAge.Item(1).Equals("Inventory") Then
AgencyStartingRows = AgencyStartingRows - 1
Else
With addAgeRec
.CommandTimeout = 600000
'insert command
.CommandText = "insert into tblAgencyReceipt
(AgencyReceiptId, [Date], ReceiverId, Bakery," & _
"Dairy, Meat, Fruit, Vegetable, Prepared, [Non-
Perishable], [Non-Food], [DateEntered], Driver," & _
"TruckNumber, DropTime, Juice, ReceiptID) values
(?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
.Parameters.Add(New OleDbParameter("AgencyRecID",
uniID))
.Parameters.Add(New OleDbParameter("Date",
oneRowAge.Item(8).Date))
.Parameters.Add(New OleDbParameter("ReceiverID",
oneRowAge.Item(0)))
.Parameters.Add(New OleDbParameter("Bakery",
oneRowAge.Item(13)))
.Parameters.Add(New OleDbParameter("Dairy",
oneRowAge.Item(14)))
.Parameters.Add(New OleDbParameter("Meat",
oneRowAge.Item(15)))
.Parameters.Add(New OleDbParameter("Fruit",
oneRowAge.Item(16)))
.Parameters.Add(New OleDbParameter("Vege",
oneRowAge.Item(17)))
.Parameters.Add(New OleDbParameter("Prep",
oneRowAge.Item(18)))
.Parameters.Add(New OleDbParameter("NP",
oneRowAge.Item(20)))
.Parameters.Add(New OleDbParameter("NF",
oneRowAge.Item(21)))
.Parameters.Add(New OleDbParameter("DateEnt",
DateTime.Today))
.Parameters.Add(New OleDbParameter("Driver",
oneRowAge.Item(11)))
.Parameters.Add(New OleDbParameter("Truck",
oneRowAge.Item(10)))
.Parameters.Add(New OleDbParameter("Time",
oneRowAge.Item(9)))
.Parameters.Add(New OleDbParameter("Juice",
oneRowAge.Item(19)))
.Parameters.Add(New OleDbParameter("ReceiptID",
uniID))
Dim fs As IO.FileStream = New IO.FileStream("C:
\testpre\Signature\Agency\" & uniID & ".bmp", IO.FileMode.Create)
fs.Write(oneRowAge.Item(12), 0,
oneRowAge.Item(12).Length)
fs.Flush()
fs.Close()
.Connection = FHDB ' connection string
.Connection.Open() ' open connection
.ExecuteNonQuery() ' execute command
.Connection.Close() ' close connection
.Dispose() ' free memory
End With
For linkRowNum As Integer = 0 To
DonorChanges.Tables(2).Rows.Count - 1
If
DonorChanges.Tables(2).Rows(linkRowNum).Item(0).Eq uals(oneRowAge.Item(23).ToString)
Then

DonorChanges.Tables(2).Rows(linkRowNum).Item(0) = uniID
End If
Next
End If
Next
Dim rowsInventory As Integer =
DonorChanges.Tables(3).Rows.Count

For rowscount As Integer = 1 To rowsInventory
Dim addInventoryRec As New OleDb.OleDbCommand
Dim oneRowInv As DataRow =
DonorChanges.Tables(3).Rows.Item((rowscount - 1))
DonorStartingRows = DonorStartingRows + 1
With addInventoryRec
.CommandTimeout = 600000
.CommandText = "insert into tblFoodDonations ([Date],
[Donor Time], [Bakery], [Meat]," & _
"[Fruit], [Dairy], [Vegetable], [Prepared],
[Juice], [Non-Perishable], [Non-Food]," & _
"[Total Donations], [DonorReceiptId], Driver,
TruckNumber, DonorID, FoodDonationsID, Description, InventoryTypeId)"
& _
"values (?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?,?)"
.Parameters.Add(New OleDbParameter("Date",
oneRowInv.Item(10).Date))
.Parameters.Add(New OleDbParameter("Time",
oneRowInv.Item(11)))
.Parameters.Add(New OleDbParameter("Bakery",
oneRowInv.Item(1)))
.Parameters.Add(New OleDbParameter("Meat",
oneRowInv.Item(3)))
.Parameters.Add(New OleDbParameter("Fruit",
oneRowInv.Item(4)))
.Parameters.Add(New OleDbParameter("Dairy",
oneRowInv.Item(2)))
.Parameters.Add(New OleDbParameter("Vege",
oneRowInv.Item(5)))
.Parameters.Add(New OleDbParameter("Prep",
oneRowInv.Item(6)))
.Parameters.Add(New OleDbParameter("Juice",
oneRowInv.Item(7)))
.Parameters.Add(New OleDbParameter("NP",
oneRowInv.Item(8)))
.Parameters.Add(New OleDbParameter("NF",
oneRowInv.Item(9)))
.Parameters.Add(New OleDbParameter("Total",
oneRowInv.Item(23)))
.Parameters.Add(New OleDbParameter("ReceiptID",
oneRowInv.Item(0)))
.Parameters.Add(New OleDbParameter("Driver",
oneRowInv.Item(12)))
.Parameters.Add(New OleDbParameter("Truck",
oneRowInv.Item(13)))
.Parameters.Add(New OleDbParameter("DonorID",
oneRowInv.Item(24)))
.Parameters.Add(New OleDbParameter("FoodID",
oneRowInv.Item(0)))
.Parameters.Add(New OleDbParameter("Description",
oneRowInv.Item(25)))
.Parameters.Add(New OleDbParameter("InvTypeID", 1))
.Connection = FHDB ' connection string
.Connection.Open() ' open connection
.ExecuteNonQuery() ' execute command
.Connection.Close() ' close connection
.Dispose() ' free memory
End With
Next

Dim daLink As New OleDb.OleDbDataAdapter("select * from
tblAgencyDonationLink", FHDB)
Dim LinkTable As New DataTable
daLink.Fill(LinkTable)

LinkStartingRows = LinkTable.Rows.Count
daLink.Dispose()
LinkTable.Dispose()

Dim rowsLink As Integer = DonorChanges.Tables(2).Rows.Count

For rowscount As Integer = 1 To rowsLink
Dim addLinkRec As New OleDb.OleDbCommand ' Declare new
command
Dim oneRowLink As DataRow =
DonorChanges.Tables(2).Rows.Item((rowscount - 1)) ' The row to be
inserted
With addLinkRec
.CommandTimeout = 600000
'insert command
.CommandText = "insert into tblAgencyDonationLink
(ReceiptID, FoodDonationsID, Bakery, Dairy, Meat," _
& "Fruit, Vegetable, Prepared, Beverage, [Non-
Perishable], [Non-Food], DateEntered, DistributionDate)" _
& "values (?,?,?,?,?,?,?,?,?,?,?,?,?)"
.Parameters.Add(New OleDbParameter("ReceiptID",
oneRowLink.Item(0)))
.Parameters.Add(New OleDbParameter("FoodID",
oneRowLink.Item(1)))
.Parameters.Add(New OleDbParameter("Bakery",
oneRowLink.Item(2)))
.Parameters.Add(New OleDbParameter("Dairy",
oneRowLink.Item(3)))
.Parameters.Add(New OleDbParameter("Meat",
oneRowLink.Item(4)))
.Parameters.Add(New OleDbParameter("Fruit",
oneRowLink.Item(5)))
.Parameters.Add(New OleDbParameter("Vege",
oneRowLink.Item(6)))
.Parameters.Add(New OleDbParameter("Prep",
oneRowLink.Item(7)))
.Parameters.Add(New OleDbParameter("Bev",
oneRowLink.Item(8)))
.Parameters.Add(New OleDbParameter("NP",
oneRowLink.Item(9)))
.Parameters.Add(New OleDbParameter("NF",
oneRowLink.Item(10)))
.Parameters.Add(New OleDbParameter("DateEnt",
DateTime.Today))
.Parameters.Add(New OleDbParameter("DistDate",
oneRowLink.Item(11)))
.Connection = FHDB ' connection string
.Connection.Open() ' open connection
.ExecuteNonQuery() ' execute command
.Connection.Close() ' close connection
.Dispose() ' free memory
End With
Next

FHDB.Dispose() ' No longer need the sting free the memory
' If all the rows were send return true else thor exeption to
catch
If EndOfTables(DonorStartingRows, AgencyStartingRows,
LinkStartingRows, DonorChanges) Then
Return True
Else
Throw New ArithmeticException
End If

End Function

<System.Web.Services.WebMethod()_
Public Function EndOfTables(ByVal DonorStartingRows As Integer,
ByVal AgencyStartingRows As Integer, ByVal LinkStartingRows As
Integer, ByVal DonorChanges As DataSet) As Boolean
Me.Server.ScriptTimeout = 600000
' Connection string to connect to access database
Dim FHDB As New
OleDb.OleDbConnection("Provider=Microsoft.Jet.OLED B.4.0;Data Source=C:
\testpre\Replica_of_be\Replica_of_harvest2000_be.m db;User
Id=admin;Password=;")

' Table adapter to get information from tables in the database
Dim daFoodDonor As New OleDb.OleDbDataAdapter("select * from
tblFoodDonations", FHDB)
Dim daAgencyRec As New OleDb.OleDbDataAdapter("select * from
tblAgencyReceipt", FHDB)
Dim daLink As New OleDb.OleDbDataAdapter("select * from
tblAgencyDonationLink", FHDB)
' Data table to store info
Dim FoodDonorTable As New DataTable
Dim AgencyRecTable As New DataTable
Dim LinkTable As New DataTable
' Fill the data table with info
daFoodDonor.Fill(FoodDonorTable)
daAgencyRec.Fill(AgencyRecTable)
daLink.Fill(LinkTable)
' Free some memory
daFoodDonor.Dispose()
daAgencyRec.Dispose()
daLink.Dispose()
' The number of rows that is supposed to be sent
Dim DonorTargetRows As Integer =
DonorChanges.Tables(0).Rows.Count
Dim AgencyTargetRows As Integer =
DonorChanges.Tables(1).Rows.Count
Dim LinkTargetRows As Integer =
DonorChanges.Tables(2).Rows.Count
' free some memory
DonorChanges.Dispose()
' The total number of rows after data has been sent
Dim DonorEndingRows As Integer = FoodDonorTable.Rows.Count
Dim AgencyEndingRows As Integer = AgencyRecTable.Rows.Count
Dim LinkEndingRows As Integer = LinkTable.Rows.Count
' free some memory
FoodDonorTable.Dispose()
AgencyRecTable.Dispose()
LinkTable.Dispose()
' The number of rows sent
Dim DonorRows As Integer = DonorEndingRows - DonorStartingRows
Dim AgencyRows As Integer = AgencyEndingRows -
AgencyStartingRows
Dim LinkRows As Integer = LinkEndingRows - LinkStartingRows
' If everything equals return true if not return false
If DonorRows.Equals(DonorTargetRows) And _
AgencyRows.Equals(AgencyTargetRows) And _
LinkRows.Equals(LinkTargetRows) Then
Return True
Else
Return False
End If
End Function

End Class

Aug 31 '07 #2
Bump

Sep 5 '07 #3
The Computer that was hosting the transfer website had its IP address
changed and that caused the connection not to work since it refered to
the url of the computer's old IP address. So I simply changed the
website url in the app files and its good to go.

Sep 11 '07 #4

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
4399
by: Mike Dole | last post by:
I'm working on a client - server application based on the 'How to Sockets Server and How to Sockets Client' code from the Visual Basic ..NET Resource Kit. Since I want to be able to send 'big...
0
9954
by: Steve - DND | last post by:
We are continually receiving timeout, and "Unable to write data to the transport connection" errors while using the System.Net.HttpWebRequest class from an ASP.Net web page. Below are the two...
1
4176
by: Muscha | last post by:
Hello, Every now and then my application throw this exception: "Unable to read data from the transport connection" And when I break into the Visual Studio, the thread where it failed has...
0
11210
by: Aryeh Holzer | last post by:
Hi, I've been trying to use the weather webservice available from the National Weather Service (NWS), at http://www.nws.noaa.gov/forecasts/xml/DWMLgen/wsdl/ndfdXML. wsdl without success. Here's...
0
679
by: Arno | last post by:
Hi, I've written a class for client-socket connection, but I get a lot of times the error message "Unable to read data from the transport connection" when restart reading the stream with...
1
4001
by: Terrance | last post by:
I'm trying to create a small messenger program that uses the tcpclient and tcplistenter objects. When I start the application and run the thread that fires the tcplistener; once the client sends...
0
789
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
3
14028
by: Buddy Home | last post by:
Hello, I'm trying to upload a file programatically and occasionally I get the following error message. Unable to write data to the transport connection: An established connection was aborted...
7
3082
by: Jay Balapa | last post by:
Hello, We have a Pocket PC client application which just connects to our webservice. When a client connects his Pocket PC through his WIFI he gets the following- Unable to read data from the...
6
8133
Cintury
by: Cintury | last post by:
Hi all, I've developed a mobile application for windows mobile 5.0 that has been in use for a while (1 year and a couple of months). It was developed in visual studios 2005 with a back-end sql...
0
7105
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
6967
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
7132
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
7180
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
1
6846
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
7341
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
5439
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
3076
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
1381
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.