Editing Info in a DataTable

P

Prasun

Hello:

How can you you edit data in a datatable? I already have the datatables
created. I want to know how i can refer to the columns in the data table and
what commands do i have for editing info in the table. I want to be able to
move the values in one column to another in the same table

Thanks
Prasun
 
G

Guest

If I understand you correctly ... To edit a value in a column in a DataTable,
follow this pattern:

int [iRowNum] = 0;
oMyDt[iRowNum]["Age"].Value = 7;

or to copy a column value form one column to another, do this:

int [iRowNum] = 0;
oMyDt[iRowNum]["FirstName"].Value = oMyDt[iRowNum]["Nickname"].Value;


-- John Papa
http://codebetter.com/blogs/john.papa
 
P

Prasun

Thank You for the help...
Will this work in VB.NET. I will try and see

Thank You
Prasun

Papa said:
If I understand you correctly ... To edit a value in a column in a
DataTable,
follow this pattern:

int [iRowNum] = 0;
oMyDt[iRowNum]["Age"].Value = 7;

or to copy a column value form one column to another, do this:

int [iRowNum] = 0;
oMyDt[iRowNum]["FirstName"].Value = oMyDt[iRowNum]["Nickname"].Value;


-- John Papa
http://codebetter.com/blogs/john.papa

Prasun said:
Hello:

How can you you edit data in a datatable? I already have the datatables
created. I want to know how i can refer to the columns in the data table
and
what commands do i have for editing info in the table. I want to be able
to
move the values in one column to another in the same table

Thanks
Prasun
 
P

Prasun

Hmmm,
Ican't seem to adjust the code for VB.NET. I am a beginner. Could i get
help with the VB.NET syntax for this code

Thank You
Prasun

Prasun said:
Thank You for the help...
Will this work in VB.NET. I will try and see

Thank You
Prasun

Papa said:
If I understand you correctly ... To edit a value in a column in a
DataTable,
follow this pattern:

int [iRowNum] = 0;
oMyDt[iRowNum]["Age"].Value = 7;

or to copy a column value form one column to another, do this:

int [iRowNum] = 0;
oMyDt[iRowNum]["FirstName"].Value = oMyDt[iRowNum]["Nickname"].Value;


-- John Papa
http://codebetter.com/blogs/john.papa

Prasun said:
Hello:

How can you you edit data in a datatable? I already have the datatables
created. I want to know how i can refer to the columns in the data table
and
what commands do i have for editing info in the table. I want to be able
to
move the values in one column to another in the same table

Thanks
Prasun
 
G

Guest

Sure.

oMyDt(iRowNum)("Age") = 7

or to copy a column value form one column to another, do this:

Dim iRowNum as Int = 7
oMyDt(iRowNum)("FirstName") = oMyDt(iRowNum)("Nickname")


.... Just noticed, I had a typo in the C# code. There is no value property.
sorry ;-)


-- John Papa
http://codebetter.com/blogs/john.papa


Prasun said:
Hmmm,
Ican't seem to adjust the code for VB.NET. I am a beginner. Could i get
help with the VB.NET syntax for this code

Thank You
Prasun

Prasun said:
Thank You for the help...
Will this work in VB.NET. I will try and see

Thank You
Prasun

Papa said:
If I understand you correctly ... To edit a value in a column in a
DataTable,
follow this pattern:

int [iRowNum] = 0;
oMyDt[iRowNum]["Age"].Value = 7;

or to copy a column value form one column to another, do this:

int [iRowNum] = 0;
oMyDt[iRowNum]["FirstName"].Value = oMyDt[iRowNum]["Nickname"].Value;


-- John Papa
http://codebetter.com/blogs/john.papa

:

Hello:

How can you you edit data in a datatable? I already have the datatables
created. I want to know how i can refer to the columns in the data table
and
what commands do i have for editing info in the table. I want to be able
to
move the values in one column to another in the same table

Thanks
Prasun
 
P

Prasun

Thank You. Much appreciated

Papa said:
Sure.

oMyDt(iRowNum)("Age") = 7

or to copy a column value form one column to another, do this:

Dim iRowNum as Int = 7
oMyDt(iRowNum)("FirstName") = oMyDt(iRowNum)("Nickname")


... Just noticed, I had a typo in the C# code. There is no value property.
sorry ;-)


-- John Papa
http://codebetter.com/blogs/john.papa


Prasun said:
Hmmm,
Ican't seem to adjust the code for VB.NET. I am a beginner. Could i get
help with the VB.NET syntax for this code

Thank You
Prasun

Prasun said:
Thank You for the help...
Will this work in VB.NET. I will try and see

Thank You
Prasun

If I understand you correctly ... To edit a value in a column in a
DataTable,
follow this pattern:

int [iRowNum] = 0;
oMyDt[iRowNum]["Age"].Value = 7;

or to copy a column value form one column to another, do this:

int [iRowNum] = 0;
oMyDt[iRowNum]["FirstName"].Value = oMyDt[iRowNum]["Nickname"].Value;


-- John Papa
http://codebetter.com/blogs/john.papa

:

Hello:

How can you you edit data in a datatable? I already have the
datatables
created. I want to know how i can refer to the columns in the data
table
and
what commands do i have for editing info in the table. I want to be
able
to
move the values in one column to another in the same table

Thanks
Prasun
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Top