Hey guys,
In my app, I have a DataTable named "dta"...
If i create a new variable of DataTable type named "dta2", and assign
the dta as value, it creates a reference to dta, then, when I make
changes in dta, dta2 is also changed...
For example:
DataTable dta2;
dta2 = dta;
(now, if I change dta, dt2 will be changed to)..
I'd like to know how to create a "copy" of "dta" (copy the structure
and data), so, when I need to change dta, dta2 will keep the original
data...
I want another instance of the dataTable, with the same structure and
data of the "copied"...
can anybody help-me? 4 5152
When doint DataTable dta2 = dta; you are acutally copying the refernce to
the original instance.
To copy the actual object, use the clone method.
DataTable copied = dta.Clone();
now copied references a new object which is equal to the original dta but is
not the same.
"Férnas" <ga*****@wideweb.com.brwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hey guys,
In my app, I have a DataTable named "dta"...
If i create a new variable of DataTable type named "dta2", and assign
the dta as value, it creates a reference to dta, then, when I make
changes in dta, dta2 is also changed...
For example:
DataTable dta2;
dta2 = dta;
(now, if I change dta, dt2 will be changed to)..
I'd like to know how to create a "copy" of "dta" (copy the structure
and data), so, when I need to change dta, dta2 will keep the original
data...
I want another instance of the dataTable, with the same structure and
data of the "copied"...
can anybody help-me?
..Clone() copies the structure alone. .Copy() copies the structure and data.
Ciaran O'Donnell
"Férnas" wrote:
Hey guys,
In my app, I have a DataTable named "dta"...
If i create a new variable of DataTable type named "dta2", and assign
the dta as value, it creates a reference to dta, then, when I make
changes in dta, dta2 is also changed...
For example:
DataTable dta2;
dta2 = dta;
(now, if I change dta, dt2 will be changed to)..
I'd like to know how to create a "copy" of "dta" (copy the structure
and data), so, when I need to change dta, dta2 will keep the original
data...
I want another instance of the dataTable, with the same structure and
data of the "copied"...
can anybody help-me?
Hey Lebesgue, thanks for your reply...
Is there a method to copy the data of the datatable too... I need the
data, not just de structure and the clone method gives me just the
structure...
thanks!
"I NEED THE STRUCTURE AND DATA PEOPLE"...
thanks...
Lebesgue escreveu:
When doint DataTable dta2 = dta; you are acutally copying the refernce to
the original instance.
To copy the actual object, use the clone method.
DataTable copied = dta.Clone();
now copied references a new object which is equal to the original dta butis
not the same.
"Férnas" <ga*****@wideweb.com.brwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hey guys,
In my app, I have a DataTable named "dta"...
If i create a new variable of DataTable type named "dta2", and assign
the dta as value, it creates a reference to dta, then, when I make
changes in dta, dta2 is also changed...
For example:
DataTable dta2;
dta2 = dta;
(now, if I change dta, dt2 will be changed to)..
I'd like to know how to create a "copy" of "dta" (copy the structure
and data), so, when I need to change dta, dta2 will keep the original
data...
I want another instance of the dataTable, with the same structure and
data of the "copied"...
can anybody help-me?
Use the Copy method then.
"Férnas" <ga*****@wideweb.com.brwrote in message
news:11*********************@i3g2000cwc.googlegrou ps.com...
Hey Lebesgue, thanks for your reply...
Is there a method to copy the data of the datatable too... I need the
data, not just de structure and the clone method gives me just the
structure...
thanks!
"I NEED THE STRUCTURE AND DATA PEOPLE"...
thanks...
Lebesgue escreveu:
When doint DataTable dta2 = dta; you are acutally copying the refernce to
the original instance.
To copy the actual object, use the clone method.
DataTable copied = dta.Clone();
now copied references a new object which is equal to the original dta but
is
not the same.
"Férnas" <ga*****@wideweb.com.brwrote in message
news:11**********************@h48g2000cwc.googlegr oups.com...
Hey guys,
In my app, I have a DataTable named "dta"...
If i create a new variable of DataTable type named "dta2", and assign
the dta as value, it creates a reference to dta, then, when I make
changes in dta, dta2 is also changed...
For example:
DataTable dta2;
dta2 = dta;
(now, if I change dta, dt2 will be changed to)..
I'd like to know how to create a "copy" of "dta" (copy the structure
and data), so, when I need to change dta, dta2 will keep the original
data...
I want another instance of the dataTable, with the same structure and
data of the "copied"...
can anybody help-me?
This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Brian Bischof |
last post by:
I'm using a third-party tool that takes a DataTable as a parameter. I really
need to pass it a DataView instead. When I try to explicitly cast the
DataView as a DataTable I get an error that they...
|
by: Stefan Turalski \(stic\) |
last post by:
Hi,
I'm wondering if there is a way to send a method parametrs by ref when
DataTabel is a type of this value ?
I done some sort of select over DataTable columns, just by removing them
froma...
|
by: VMI |
last post by:
I have a filled datatable and I need to copy this data into an Access table
with exactly the same table structure. Can I do this without having to run
an Insert query for every line of the...
|
by: Kelvin |
last post by:
Hi All,
Due to can't insert new row between row and row while current
DataTable looping.
In order to solve the problem, I need to clone it as new DataTable,
while the DataTable Looping, it also...
|
by: Gene Hubert |
last post by:
I'm using DataTable.ImportRow to move data from one datatable to
another...
Dim dt, dtTarget As DataTable
Dim dr As DataRow
dt = DirectCast(Me.DataSource, DataTable)
dtTarget = dt.Clone...
|
by: Rich |
last post by:
Hello,
I am populating a datagridview from a datatable and filtering the number of
rows with a dataview object. Is there a way to retrieve the rows displayed
by the datagridview into a separate...
|
by: Katit |
last post by:
I get dataset from database. I need to take specific datatable out of
it and add it to second dataset to pass back from webservice.
ds.Tables.Add(dsPart.Tables);
I get exception "Datatable...
|
by: mikejacobz |
last post by:
Hi, I have a Datatable which I would like to copy into two other
DataTables.
The first copy of the DataTable would contain the first 1/2 of the
original DataTable whilst the second DataTable...
|
by: Mdotnetdeveloper |
last post by:
hi,
i am trying to achieve this:
i have 2 different databses. i need to get data from one databse (for eg. in a datset), copy it into another dateset (pointing to the second database), make...
|
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...
|
by: nemocccc |
last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
|
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...
|
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...
|
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,...
|
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: 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...
|
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,...
|
by: isladogs |
last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM).
In this session, we are pleased to welcome a new...
| |