473,387 Members | 1,925 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,387 software developers and data experts.

Posting a dataset to a database

vaj
Hey,
Im creating a system on a pocket pc based on win ce 4.2 and i need to
tranfer three datasets to a remote server on the network.Could anyone
tell me the easiest way to do this?
cheers,
-vaj

Jun 28 '06 #1
5 1088
vaj wrote:
Hey,
Im creating a system on a pocket pc based on win ce 4.2 and i need to
tranfer three datasets to a remote server on the network.Could anyone
tell me the easiest way to do this?
cheers,
-vaj


Here's a solution that I'm trying to get working on one of my own
projects. It pretty much works, although I don't know if it's a best
practice or anything...(Maybe some others can weigh in on the overall
approach.)

I'm not sure what the .NET framework looks like on WinCE, but in the
full .NET framework, you can get a dataset containing just
updated/changed data with something like:

dsModified = dsModified.GetChanges()

See the docs on .GetChanges for a fuller explanation of some options
there.

Then you take that dataset and pass it to a web service, which has a
web method that accepts a dataset as a parameter, and merges it with a
dataset containing the latest data from the server (da = data adapter,
ds = dataset):

sql = "SELECT NameFirst, NameLast FROM tblContacts"
cn = DBConnect()
cn.Open()
daOriginal = New SqlDataAdapter(sql, cn)
daOriginal.Fill(dsOriginal)
dsOriginal.Merge(dsModified)

Then you write the data to the database:

daOriginal.UpdateCommand = cmd.GetUpdateCommand()
daOriginal.Update(dsOriginal)

We've had to do some other things like explicitly setting the primary
key on dsModified to match the pkey on dsOriginal, but that might be
due to some conversions to and from XML and old-style ADO recordsets we
do between the various layers of the app.

If nothing merges in, it may be because the rowstate of the dateset
rows have been set back to "unchanged" as it came into the web service.
In ADO.NET 2.0, you can apparently manually set the rowstate of the
rows.

The MSDN on .Merge is pretty helpful, although it doesn't seem to
recommend using Merge for this purpose.

Jun 28 '06 #2
Vaj,

If it are alone inserts of new rows and the schemas are complete equal (the
pocket pc dataset may miss columns exept the primary key), than it is
relative simple.

If it are also updates than it will be much more work, if the original
dataset is not retrieved from that database.

Therefore what is it?

Cor
"vaj" <va*@spaceair.co.uk> schreef in bericht
news:11**********************@y41g2000cwy.googlegr oups.com...
Hey,
Im creating a system on a pocket pc based on win ce 4.2 and i need to
tranfer three datasets to a remote server on the network.Could anyone
tell me the easiest way to do this?
cheers,
-vaj

Jun 28 '06 #3
vaj
thanks guys but i dont think i explained the problem correctly,sorry!
the thing im not looking to tranfer the datasets on to the database in
the device but to a remote server.
tried RDA but my sql server isnt compatible with the version of the
server i have on the device.So what me and my colligues thought was to
do a http posting to the serevr.but the problem is non of us know how
to do this.
could any of u tell me how to do this or is there anyother way i can
get this data transferred?
ad*****@yahoo.com wrote:
vaj wrote:
Hey,
Im creating a system on a pocket pc based on win ce 4.2 and i need to
tranfer three datasets to a remote server on the network.Could anyone
tell me the easiest way to do this?
cheers,
-vaj


Here's a solution that I'm trying to get working on one of my own
projects. It pretty much works, although I don't know if it's a best
practice or anything...(Maybe some others can weigh in on the overall
approach.)

I'm not sure what the .NET framework looks like on WinCE, but in the
full .NET framework, you can get a dataset containing just
updated/changed data with something like:

dsModified = dsModified.GetChanges()

See the docs on .GetChanges for a fuller explanation of some options
there.

Then you take that dataset and pass it to a web service, which has a
web method that accepts a dataset as a parameter, and merges it with a
dataset containing the latest data from the server (da = data adapter,
ds = dataset):

sql = "SELECT NameFirst, NameLast FROM tblContacts"
cn = DBConnect()
cn.Open()
daOriginal = New SqlDataAdapter(sql, cn)
daOriginal.Fill(dsOriginal)
dsOriginal.Merge(dsModified)

Then you write the data to the database:

daOriginal.UpdateCommand = cmd.GetUpdateCommand()
daOriginal.Update(dsOriginal)

We've had to do some other things like explicitly setting the primary
key on dsModified to match the pkey on dsOriginal, but that might be
due to some conversions to and from XML and old-style ADO recordsets we
do between the various layers of the app.

If nothing merges in, it may be because the rowstate of the dateset
rows have been set back to "unchanged" as it came into the web service.
In ADO.NET 2.0, you can apparently manually set the rowstate of the
rows.

The MSDN on .Merge is pretty helpful, although it doesn't seem to
recommend using Merge for this purpose.


Jun 29 '06 #4
vaj, we understand the issue. what we are suggesting is setting up a
..NET web service on the server, creating a web method to process the
incoming dataset from your pocket pc, and then passing the dataset from
the pocket pc to the web service. you should read up on web services to
see how they work:

http://www.codeproject.com/dotnet/intro2websvc.asp

basically, the pocket pc will be the client or consumer of the web
service. on the app you are writing for the pocket pc, you include a
"web reference" to the web service server. then, on the pocket pc, you
call a method from the web service on the server, like:

MyWebService.UpdateData(dsUpdatedDataset)

This will send your dataset over to the web service, which can process
the modifications and write them to the database.

please post back to this thread with more questions instead of creating
another new thread on the newsgroup. you have triple-posted this
question already.

vaj wrote:
thanks guys but i dont think i explained the problem correctly,sorry!
the thing im not looking to tranfer the datasets on to the database in
the device but to a remote server.
tried RDA but my sql server isnt compatible with the version of the
server i have on the device.So what me and my colligues thought was to
do a http posting to the serevr.but the problem is non of us know how
to do this.
could any of u tell me how to do this or is there anyother way i can
get this data transferred?
ad*****@yahoo.com wrote:
vaj wrote:
Hey,
Im creating a system on a pocket pc based on win ce 4.2 and i need to
tranfer three datasets to a remote server on the network.Could anyone
tell me the easiest way to do this?
cheers,
-vaj


Here's a solution that I'm trying to get working on one of my own
projects. It pretty much works, although I don't know if it's a best
practice or anything...(Maybe some others can weigh in on the overall
approach.)

I'm not sure what the .NET framework looks like on WinCE, but in the
full .NET framework, you can get a dataset containing just
updated/changed data with something like:

dsModified = dsModified.GetChanges()

See the docs on .GetChanges for a fuller explanation of some options
there.

Then you take that dataset and pass it to a web service, which has a
web method that accepts a dataset as a parameter, and merges it with a
dataset containing the latest data from the server (da = data adapter,
ds = dataset):

sql = "SELECT NameFirst, NameLast FROM tblContacts"
cn = DBConnect()
cn.Open()
daOriginal = New SqlDataAdapter(sql, cn)
daOriginal.Fill(dsOriginal)
dsOriginal.Merge(dsModified)

Then you write the data to the database:

daOriginal.UpdateCommand = cmd.GetUpdateCommand()
daOriginal.Update(dsOriginal)

We've had to do some other things like explicitly setting the primary
key on dsModified to match the pkey on dsOriginal, but that might be
due to some conversions to and from XML and old-style ADO recordsets we
do between the various layers of the app.

If nothing merges in, it may be because the rowstate of the dateset
rows have been set back to "unchanged" as it came into the web service.
In ADO.NET 2.0, you can apparently manually set the rowstate of the
rows.

The MSDN on .Merge is pretty helpful, although it doesn't seem to
recommend using Merge for this purpose.


Jun 29 '06 #5
vaj
ok think i get it.,thanks guys
ad*****@yahoo.com wrote:
vaj, we understand the issue. what we are suggesting is setting up a
.NET web service on the server, creating a web method to process the
incoming dataset from your pocket pc, and then passing the dataset from
the pocket pc to the web service. you should read up on web services to
see how they work:

http://www.codeproject.com/dotnet/intro2websvc.asp

basically, the pocket pc will be the client or consumer of the web
service. on the app you are writing for the pocket pc, you include a
"web reference" to the web service server. then, on the pocket pc, you
call a method from the web service on the server, like:

MyWebService.UpdateData(dsUpdatedDataset)

This will send your dataset over to the web service, which can process
the modifications and write them to the database.

please post back to this thread with more questions instead of creating
another new thread on the newsgroup. you have triple-posted this
question already.

vaj wrote:
thanks guys but i dont think i explained the problem correctly,sorry!
the thing im not looking to tranfer the datasets on to the database in
the device but to a remote server.
tried RDA but my sql server isnt compatible with the version of the
server i have on the device.So what me and my colligues thought was to
do a http posting to the serevr.but the problem is non of us know how
to do this.
could any of u tell me how to do this or is there anyother way i can
get this data transferred?
ad*****@yahoo.com wrote:
vaj wrote:
> Hey,
> Im creating a system on a pocket pc based on win ce 4.2 and i need to
> tranfer three datasets to a remote server on the network.Could anyone
> tell me the easiest way to do this?
> cheers,
> -vaj

Here's a solution that I'm trying to get working on one of my own
projects. It pretty much works, although I don't know if it's a best
practice or anything...(Maybe some others can weigh in on the overall
approach.)

I'm not sure what the .NET framework looks like on WinCE, but in the
full .NET framework, you can get a dataset containing just
updated/changed data with something like:

dsModified = dsModified.GetChanges()

See the docs on .GetChanges for a fuller explanation of some options
there.

Then you take that dataset and pass it to a web service, which has a
web method that accepts a dataset as a parameter, and merges it with a
dataset containing the latest data from the server (da = data adapter,
ds = dataset):

sql = "SELECT NameFirst, NameLast FROM tblContacts"
cn = DBConnect()
cn.Open()
daOriginal = New SqlDataAdapter(sql, cn)
daOriginal.Fill(dsOriginal)
dsOriginal.Merge(dsModified)

Then you write the data to the database:

daOriginal.UpdateCommand = cmd.GetUpdateCommand()
daOriginal.Update(dsOriginal)

We've had to do some other things like explicitly setting the primary
key on dsModified to match the pkey on dsOriginal, but that might be
due to some conversions to and from XML and old-style ADO recordsets we
do between the various layers of the app.

If nothing merges in, it may be because the rowstate of the dateset
rows have been set back to "unchanged" as it came into the web service.
In ADO.NET 2.0, you can apparently manually set the rowstate of the
rows.

The MSDN on .Merge is pretty helpful, although it doesn't seem to
recommend using Merge for this purpose.


Jun 30 '06 #6

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

Similar topics

4
by: Frnak McKenney | last post by:
I'm using an in-core DataSet as an image of my application's 'database' (a multi-table Access97 mdb file). Updates are made to the DataTables within the DataSet via forms with bound TextBoxes,...
5
by: Grant | last post by:
Hello, How come when I add a new row to my dataset table it shows up as changed (agencyData.Haschanges() = True) but when I delete a row the dataset thinks here are no...
1
by: Asha | last post by:
greetings, i've manually created a dataset which contains data input from users. i validate the dataset against the business logic and once everything is done, i would like to save the values in...
22
by: EMW | last post by:
Hi, I managed to create a SQL server database and a table in it. The table is empty and that brings me to my next chalenge: How can I get the info in the table in the dataset to go in an empty...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
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
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
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,...

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.