S
Sheikko
ADO.NET - Working with DataSet
=========================
HI, I want to create an application that interact with a DB. I wont to
use SQL statement, but I want to use DataSet.
- I have created my application
- From SERVER EXPLORER panel, I have added a connection to a database
(MyDB) and the name of the dataset is "MyDBDataSet" .
- From DATA SOURCE panel, I have added Tables that I want to use
(Setting).
- When I click a button from my application I want to populate a table
with some values, so I write the following code:
MyDBDataSet.SettingDataTable Setting = new
MyDBDataSet.SettingDataTable();
DataRow SettingRow = Setting.NewRow();
private void button1_Click(object sender, EventArgs e)
{
SettingRow["Name"] = "Name1";
SettingRow["Age"] = 26;
SettingRow["City"] = "City1";
Setting.Rows.Add(SettingRow);
Setting.AcceptChanges();
}
When I close the application the Database is not Syncronized with the
DataTable.
Have you any Idea?
I want to make it working with Pocket PC, but I have the same problem
on the PC.
I found some examples in the net, and they make the same operations I
made.
Here some links:
http://www.java2s.com/Code/CSharp/D...objectandsynchronizingthosechangeswiththe.htm
http://www.functionx.com/vcsharp/databases/datarow.htm
http://en.csharp-online.net/Working_with_Data—Adding_Rows_of_Data
THank you very much
=========================
HI, I want to create an application that interact with a DB. I wont to
use SQL statement, but I want to use DataSet.
- I have created my application
- From SERVER EXPLORER panel, I have added a connection to a database
(MyDB) and the name of the dataset is "MyDBDataSet" .
- From DATA SOURCE panel, I have added Tables that I want to use
(Setting).
- When I click a button from my application I want to populate a table
with some values, so I write the following code:
MyDBDataSet.SettingDataTable Setting = new
MyDBDataSet.SettingDataTable();
DataRow SettingRow = Setting.NewRow();
private void button1_Click(object sender, EventArgs e)
{
SettingRow["Name"] = "Name1";
SettingRow["Age"] = 26;
SettingRow["City"] = "City1";
Setting.Rows.Add(SettingRow);
Setting.AcceptChanges();
}
When I close the application the Database is not Syncronized with the
DataTable.
Have you any Idea?
I want to make it working with Pocket PC, but I have the same problem
on the PC.
I found some examples in the net, and they make the same operations I
made.
Here some links:
http://www.java2s.com/Code/CSharp/D...objectandsynchronizingthosechangeswiththe.htm
http://www.functionx.com/vcsharp/databases/datarow.htm
http://en.csharp-online.net/Working_with_Data—Adding_Rows_of_Data
THank you very much