Insert new record via DataSet

  • Thread starter Thread starter Guest
  • Start date Start date
G

Guest

H
How do I add a new row via dataset
I have a dataset which I populate it's data by myself, and I'm not use DataAdapter
May be I have to to use an DataAdapter that return no rows, but builds the dataset for me, and then Usa the update of dataAdaper
If it's true, how do I do it
thank
 
You have to use code similar to the following

DataRow newRow = dataSet["TableName"].NewRow();
newRow["Name"] = "Test";
newRow["ID"] = 100;

dataSet["TableName"].Rows.Add(newRow);

--
-Sijin Joseph
http://weblogs.asp.net/sjoseph


Yanir said:
Hi
How do I add a new row via dataset?
I have a dataset which I populate it's data by myself, and I'm not use DataAdapter.
May be I have to to use an DataAdapter that return no rows, but builds the
dataset for me, and then Usa the update of dataAdaper?
 
Thank you Sijin
I see that I haven't wrote it clear
My aim is to associate the dataset, which I made by myself with a DB table, with a dataadapter in order to insert the Dataset data into the DB tabl

----- Sijin Joseph wrote: ----

You have to use code similar to the followin

DataRow newRow = dataSet["TableName"].NewRow()
newRow["Name"] = "Test"
newRow["ID"] = 100

dataSet["TableName"].Rows.Add(newRow)

--
-Sijin Josep
http://weblogs.asp.net/sjosep


Yanir said:
H
How do I add a new row via dataset
I have a dataset which I populate it's data by myself, and I'm not us DataAdapter
May be I have to to use an DataAdapter that return no rows, but builds th
dataset for me, and then Usa the update of dataAdaper
 
Back
Top