473,385 Members | 1,908 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,385 software developers and data experts.

Need help fast, DataSet question!

I'm trying to copy data from two tables in a Source db into two Tables in a
Destination db and the Tables designa are the same.

I created 4 adapters...

2 for the two tables in the source db
2 for the 2 tables in the destination db

Then I filled a SourceDataSet with the Source adapters

and then I update the destination adapters with the SourceDataset.

But the information is not copied, what can I do???

I need help really fast, please!

/Lars
Nov 20 '05 #1
13 1256
Hi Lars,

First of all, we try to learn as well from this newsgroup and like to have
some feedback on questions.

I don't know how it is with others, however when I give an answer I get the
idea, that you never read it.

To give an answer on your question. What do you mean with copy because I get
the idea because you are talking about a dataadapter, that it is not this
code?

dim datasetNew as new dataset = datasetOld.copy

Cor
Nov 20 '05 #2
Okay I have this code!

Private Sub Importdata()

Try

dsDestination = dsSource.Copy

adpDestinationDisk.Update(dsDestination, "Disktable")

adpDestinationEvent.Update(dsDestination, "Eventtable")

Catch ex As Exception

MsgBox(ex.Message)

End Try

DataGrid2.DataSource = dsDestination

End Sub
I dataset is updated alright but the changes are never written into the
Database associated with the Destination adapters.

I don't get any error, the Update Just does'nt seem to happen. But the
Datagrid shows the dataset fine.

And about the first thign you wrote, you mean I never say thank you or you
mean I don't answer questions?

I do both, but as you probably have noticed, i'm not that good yet and most
questions I have no idea abotu how to answer.

I'm very thankful I get answers in here, it's helping me a lot!

/Lars


"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:%2****************@tk2msftngp13.phx.gbl...
Hi Lars,

First of all, we try to learn as well from this newsgroup and like to have
some feedback on questions.

I don't know how it is with others, however when I give an answer I get the idea, that you never read it.

To give an answer on your question. What do you mean with copy because I get the idea because you are talking about a dataadapter, that it is not this
code?

dim datasetNew as new dataset = datasetOld.copy

Cor

Nov 20 '05 #3
Hi Lars,

Am I right that the second update does not work and the first does.

The dataadapter has an automaticly accept.changes in it with a full dataset.
So all rowstates will be set as done and your second update *should* never
work.

If this does not answer your question, reply?

Cor
Nov 20 '05 #4
You might be on to something here.. I never thought about that the second
update might never happen and that will explain why the database in not
updated I guess.. but what can I do About this?

Why "should" it not work?
/Lars

"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:O1**************@tk2msftngp13.phx.gbl...
Hi Lars,

Am I right that the second update does not work and the first does.

The dataadapter has an automaticly accept.changes in it with a full dataset. So all rowstates will be set as done and your second update *should* never
work.

If this does not answer your question, reply?

Cor

Nov 20 '05 #5
Hi Lars.

I think you can try to use a copy dataset to update, or you can do the
first update using dataset.getchanges because I saw than the datarowsetting
is not changed. However I am not sure if that last is as it should be or
that it is a bug and when it is the last you can get problems in future, I
am not using that one anymore.

Have a look at this article for the working of the update, in my opinion it
describes that very well.

http://msdn.microsoft.com/library/de...pdatetopic.asp

(Did you look at the command haschanges too, it is very usefull)
if dataset.haschanges then
update
end if

If not clear, reply?

Cor
Nov 20 '05 #6
Still don't get it.

I mean... My Datasets are all updated Fine... but Not the adapters, but the
don't give me any error!

/Lars

"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:Ow**************@TK2MSFTNGP12.phx.gbl...
Hi Lars.

I think you can try to use a copy dataset to update, or you can do the
first update using dataset.getchanges because I saw than the datarowsetting is not changed. However I am not sure if that last is as it should be or
that it is a bug and when it is the last you can get problems in future, I
am not using that one anymore.

Have a look at this article for the working of the update, in my opinion it describes that very well.

http://msdn.microsoft.com/library/de...pdatetopic.asp
(Did you look at the command haschanges too, it is very usefull)
if dataset.haschanges then
update
end if

If not clear, reply?

Cor

Nov 20 '05 #7
I have gone the booring way now... I fiuxed it wil ExecuteNOnQuerys and
wrote the Updates myself.. I have fixed my "mission" but not in the way I
wanted and I still dont' get why I can't

Fill one Dataset with one adapter... copy it and then use the DatasetCopy to
update the another adapter.

/Lars
"Lars Netzel" <[no_spam_please]la*********@qlogic.se> skrev i meddelandet
news:%2***************@tk2msftngp13.phx.gbl...
Still don't get it.

I mean... My Datasets are all updated Fine... but Not the adapters, but the don't give me any error!

/Lars

"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:Ow**************@TK2MSFTNGP12.phx.gbl...
Hi Lars.

I think you can try to use a copy dataset to update, or you can do the
first update using dataset.getchanges because I saw than the

datarowsetting
is not changed. However I am not sure if that last is as it should be or
that it is a bug and when it is the last you can get problems in future, I am not using that one anymore.

Have a look at this article for the working of the update, in my opinion

it
describes that very well.

http://msdn.microsoft.com/library/de...pdatetopic.asp

(Did you look at the command haschanges too, it is very usefull)
if dataset.haschanges then
update
end if

If not clear, reply?

Cor


Nov 20 '05 #8
When I use the HasChanges check it seems the dataset is actually not
updated.. It never goes into my IF statement although dsDestination is
originally Empty and the dsSource.Copy is not giving an error...

Private Function Importdata() As Boolean
Try
dsDestination = dsSource.Copy
If dsDestination.HasChanges Then
adpDestinationDisk.Update(dsDestination, "Disktable")
adpDestinationEvent.Update(dsDestination, "Eventtable")
DestinationGrid.DataSource =
dsDestination.Tables("Eventtable")
Return True
Else
DestinationGrid.DataSource() =
dsDestination.Tables("Eventtable")
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try

/Lars
"Lars Netzel" <[no_spam_please]la*********@qlogic.se> skrev i meddelandet
news:uV**************@tk2msftngp13.phx.gbl...
I have gone the booring way now... I fiuxed it wil ExecuteNOnQuerys and
wrote the Updates myself.. I have fixed my "mission" but not in the way I
wanted and I still dont' get why I can't

Fill one Dataset with one adapter... copy it and then use the DatasetCopy to update the another adapter.

/Lars
"Lars Netzel" <[no_spam_please]la*********@qlogic.se> skrev i meddelandet
news:%2***************@tk2msftngp13.phx.gbl...
Still don't get it.

I mean... My Datasets are all updated Fine... but Not the adapters, but the
don't give me any error!

/Lars

"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:Ow**************@TK2MSFTNGP12.phx.gbl...
Hi Lars.

I think you can try to use a copy dataset to update, or you can do the first update using dataset.getchanges because I saw than the

datarowsetting
is not changed. However I am not sure if that last is as it should be or that it is a bug and when it is the last you can get problems in future, I
am not using that one anymore.

Have a look at this article for the working of the update, in my
opinion it
describes that very well.

http://msdn.microsoft.com/library/de...pdatetopic.asp
(Did you look at the command haschanges too, it is very usefull)
if dataset.haschanges then
update
end if

If not clear, reply?

Cor



Nov 20 '05 #9
Hi Lars,

What is the code before that, where you put the changes in the dataset.
The most made mistake is that people put an dataset.acceptchanges somewhere
before the update, what means that all updates will be set as done.

Cor
Nov 20 '05 #10

The only code I have is in The Form_Load

adpSourceDisk.Fill(dsSource, "DiskTable")
adpSourceEvent.Fill(dsSource, "EventTable")
SourceGrid.DataSource = dsSource
adpDestinationDisk.Fill(dsDestination, "DiskTable")
adpDestinationEvent.Fill(dsDestination, "EventTable")
DestinationGrid.DataSource = dsDestination

'************************************************* **************

This gives me an empty Grid, and that's fine, it should be empty in the
beginning.

'And then the rest that you've seen before

'************************************************* **********

Private Function Importdata() As Boolean
Try
dsDestination = dsSource.Copy
If dsDestination.HasChanges Then
adpDestinationDisk.Update(dsDestination, "Disktable")
adpDestinationEvent.Update(dsDestination, "Eventtable")
DestinationGrid.DataSource =
dsDestination.Tables("Eventtable")
Return True
Else
DestinationGrid.DataSource() =
dsDestination.Tables("Eventtable")
End If
Catch ex As Exception
MsgBox(ex.Message)
Return False
End Try
Enf Function

/lars


"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet
news:e9**************@TK2MSFTNGP11.phx.gbl...
Hi Lars,

What is the code before that, where you put the changes in the dataset.
The most made mistake is that people put an dataset.acceptchanges somewhere before the update, what means that all updates will be set as done.

Cor

Nov 20 '05 #11
Hi Lars,

I think that I now understand, what you mean with copying.

When you fill all datarowstatuses are unchanged, that is done by the fill which does to an automatic acceptchanges.

You can set it as changed by dataadapter.acceptchangesduringfill property to false

http://msdn.microsoft.com/library/de...gfilltopic.asp

I think you are almost there now?

Cor
Nov 20 '05 #12
Lars,
David Sceppa's book "Microsoft ADO.NET - Core Reference" from MS press
discusses how to get the DataSet to copy from one DB to another.

Unfortunately my copy of Sceppa's book is at the office.

Sceppa's book is both a good tutorial on ADO.NET as well as a good desk
reference once you know ADO.NET

Hope this helps
Jay
"Lars Netzel" <[no_spam_please]la*********@qlogic.se> wrote in message
news:%2****************@TK2MSFTNGP10.phx.gbl...
I'm trying to copy data from two tables in a Source db into two Tables in a Destination db and the Tables designa are the same.

I created 4 adapters...

2 for the two tables in the source db
2 for the 2 tables in the destination db

Then I filled a SourceDataSet with the Source adapters

and then I update the destination adapters with the SourceDataset.

But the information is not copied, what can I do???

I need help really fast, please!

/Lars

Nov 20 '05 #13
YOU ROCK!

That was all I had to do.. set the property to False!

Thank you very much!

Best Regards!
/Lars
"Cor Ligthert" <no**********@planet.nl> skrev i meddelandet news:%2***************@TK2MSFTNGP10.phx.gbl...
Hi Lars,

I think that I now understand, what you mean with copying.

When you fill all datarowstatuses are unchanged, that is done by the fill which does to an automatic acceptchanges.

You can set it as changed by dataadapter.acceptchangesduringfill property to false

http://msdn.microsoft.com/library/de...gfilltopic.asp

I think you are almost there now?

Cor
Nov 20 '05 #14

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

Similar topics

8
by: Neil | last post by:
I have a very puzzling situation with a database. It's an Access 2000 mdb with a SQL 7 back end, with forms bound using ODBC linked tables. At our remote location (accessed via a T1 line) the time...
4
by: Steve Klett | last post by:
(I posted this in ADO group, but I think this group will be better) Hi- I need to develop an FAQ section for our website. We would like to break up the FAQ by products, then categories with...
15
by: scorpion53061 | last post by:
I have a time critical function I need assistance with. You should be familiar with windows forms, ADO.NET and MS Word Automation. If you are interested please email me at ...
2
by: -=JLK=- | last post by:
All, I'm looking for opinions on the best way to accomplish a given task. Here is the senario: I have a Data Warehouse that I need to update with information that has been loaded into a...
3
by: mateo | last post by:
Hello i would like to have advices on an ASP.NET 2 application that i must develop. I'm new to ASP.NET, i am more of WinApp developper, so if there is some experienced folks out there all advices...
1
by: batista | last post by:
Hello all, I have a third praty grid control...named C1grid. Im using it in one of my apps.. Now, I have bind this grid to a custom dataset class named "DataViewEx". The code of the class is...
1
by: Richard Lewis Haggard | last post by:
I need to get up to speed on the new dataset object fast. Can someone recommend a primer or other highly condensed tutorial that will give me an intense injection of practical knowledge on how...
12
by: Boris Ozegovic | last post by:
Hi, I am working on some system, and the communication will take place through the chatterbot which will be written in AIML (interpreter is written in Python). English is not my mother tongue,...
5
by: ElPresidente | last post by:
Now that I have your attention haha... I have this weekly file that contains several hundred invoices that need to be given batch letters in according to the following hierarchy. Employee...
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: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
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
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.