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

ADO.NET - Working with DataSet

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/Da...geswiththe.htm
http://www.functionx.com/vcsharp/databases/datarow.htm
http://en.csharp-online.net/Working_...g_Rows_of_Data

THank you very much

May 24 '07 #1
2 1502
Updating the DataSet does not automatically update the underlying database.
You have to do that yourself, in your code, as there are different
approaches to updating the underlying database, depending on the
requirements. You may want to wait until a number of records have been
changed, all columns in a record have changed, or as each column is
changed.

The DataSet contains methods for updating the underlying database.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:
http://www.miradyne.net

"Sheikko" <sh*****@gmail.comwrote in message
news:11**********************@q69g2000hsb.googlegr oups.com...
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/Da...geswiththe.htm
http://www.functionx.com/vcsharp/databases/datarow.htm
http://en.csharp-online.net/Working_...g_Rows_of_Data

THank you very much

May 24 '07 #2
On May 24, 12:49 pm, "Kevin Spencer" <unclechut...@nothinks.com>
wrote:
Updating the DataSet does not automatically update the underlying database.
You have to do that yourself, in your code, as there are different
approaches to updating the underlying database, depending on the
requirements. You may want to wait until a number of records have been
changed, all columns in a record have changed, or as each column is
changed.

The DataSet contains methods for updating the underlying database.

--
HTH,

Kevin Spencer
Microsoft MVP

Printing Components, Email Components,
FTP Client Classes, Enhanced Data Controls, much more.
DSI PrintManager, Miradyne Component Libraries:http://www.miradyne.net

"Sheikko" <shei...@gmail.comwrote in message

news:11**********************@q69g2000hsb.googlegr oups.com...
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/Da...stratestheuseo...
http://www.functionx.com/vcsharp/databases/datarow.htm
http://en.csharp-online.net/Working_...dding_Rows_of_...
THank you very much
THank you, but the way to update database is throught Tabla_Adapter. I
added two line in my code:

SettingTA = new
DataSetTest.MyDBDataSetTableAdapters.SettingTableA dapter();
SettingTA.update(Setting);

where setting is my dataTable.
May 25 '07 #3

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

Similar topics

10
by: April | last post by:
Hope someone can help me The SQL string i need to use does not work, Who can help me.... Thanks in advance Dim strConn As String Dim strSQL As String
2
by: | last post by:
Hello, I have a GridView in my ASP.NET 2.0 application that performs the paging feature perfect when I have it bound to a data source. But now I have it bound to a dataset and the paging...
5
by: glenn | last post by:
Hi folks, The problem I have is that a query string works if hard-coded but if I pass a variable to it, it does not work as shown here. This works: querystring="SELECT * FROM USERS WHERE...
1
by: matt | last post by:
hello, i have a web app that allows users to query our oracle db and produce a dataset of report data. they then have the option to serialize this data and store it in the database. later, then...
3
by: UJ | last post by:
I've got a working web service that we are moving to another machine and now I suddenly get the following error. While transferring the files, got the following message:...
2
by: tshad | last post by:
I have been using a schema.ini file to define the columns of my .csv files that has been working fine. But I just tried one where it doesn't work. I have the following schema.ini file: ...
3
by: Sheikko | last post by:
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...
2
by: =?Utf-8?B?c2lwcHl1Y29ubg==?= | last post by:
Have a complex process where I need to Import a large amount of data then run some transformations on this data then import into DataBase. The transformation involves multiple fields and multiple...
0
by: Mark112 | last post by:
Hi I am attempting to restore the search feature that was created by an external company using the indexing service for our intranet. the intranet is located locally at each of our offices. The...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

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.