Hi, I have a datagrid and its source is a dataset. When I change information
on the grid does that automatically gets change in the dataset? If not then
how do I do that? I use the following update statement when the form is
closed to udpate the database but the changes are not there.
oleDbDataAdapter1.Update(dsVehicle, "vehDetail");
Thanks, Alpha 3 2672
Hi,
You could try
dsVehicle.Tables[ "vehDetail" ].RowChanged +=
new DataRowChangeEventHandler(dataRow_Change);
..
..
..
private void DataRow_Change(object sender, DataRowChangeEventArgs e)
{
oleDbDataAdapter1.Update(dsVehicle, "vehDetail");
}
All the best,
Phil.
"Alpha" wrote: Hi, I have a datagrid and its source is a dataset. When I change information on the grid does that automatically gets change in the dataset? If not then how do I do that? I use the following update statement when the form is closed to udpate the database but the changes are not there. oleDbDataAdapter1.Update(dsVehicle, "vehDetail");
Thanks, Alpha
I definitely see action with the code you gave me. Thank you very much.
However, I'm getting update error. One of the column in the dataset is a
primary key in the database. The update command is automatically generated
when I add the dbapater control to the form. It tries to update the primary
key columnas well.
Can you suggest how I can fix this problem? Thanks.
I'm gonna try to set that column in dataset to a primary key and see if that
would help.
"Phil Williams" wrote: Hi, You could try
dsVehicle.Tables[ "vehDetail" ].RowChanged += new DataRowChangeEventHandler(dataRow_Change); . . . private void DataRow_Change(object sender, DataRowChangeEventArgs e) { oleDbDataAdapter1.Update(dsVehicle, "vehDetail"); }
All the best, Phil.
"Alpha" wrote:
Hi, I have a datagrid and its source is a dataset. When I change information on the grid does that automatically gets change in the dataset? If not then how do I do that? I use the following update statement when the form is closed to udpate the database but the changes are not there. oleDbDataAdapter1.Update(dsVehicle, "vehDetail");
Thanks, Alpha
I just open the dataset schema and it already has a primary key marked on the
correct column, VID. I don't understand why the dbadapter.Update command
would still try to update that.
"Phil Williams" wrote: Hi, You could try
dsVehicle.Tables[ "vehDetail" ].RowChanged += new DataRowChangeEventHandler(dataRow_Change); . . . private void DataRow_Change(object sender, DataRowChangeEventArgs e) { oleDbDataAdapter1.Update(dsVehicle, "vehDetail"); }
All the best, Phil.
"Alpha" wrote:
Hi, I have a datagrid and its source is a dataset. When I change information on the grid does that automatically gets change in the dataset? If not then how do I do that? I use the following update statement when the form is closed to udpate the database but the changes are not there. oleDbDataAdapter1.Update(dsVehicle, "vehDetail");
Thanks, Alpha This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: PAUL EDWARDS |
last post by:
I have a windows form that is bound to a datatable. In VB6
I could just update the field contents and it would be
updated in the database, however if I update the text
property of the control from...
|
by: Darryn |
last post by:
Hi
I am having a few problems with one of my forms... I have a data grid bound
to a dataset using a currencymanager and it's all working fine. However when
i edit or change any of the data in...
|
by: certolnut |
last post by:
HI all
New to C#
I'm merging datasets. The source dataset is an excel file and the target
dataset is in SqlServer.
...
|
by: dawn |
last post by:
Hi, anyone can help me to solve this little problem that
i've spent a lot of time to solve it!! but i can't!!!!
actually, i use a DataGrid, and i'd like to save the
changed data! ( this is...
|
by: abdoly |
last post by:
i wrote a code to update datagrid with the datagrid updatecommand but i cant get the updated values after being update
that is the code
private void DataGrid1_UpdateCommand(object source,...
|
by: D. Shane Fowlkes |
last post by:
I have a Datagrid which in theory, should allow you to edit and update the
records. I've stripped my test page down so that it's only attempting to
update one field - "description". Yet when I...
|
by: Lyners |
last post by:
I have a web page writen in ASP.NET that contains some javascript so that
when a user presses a button, or edits a certain field in a datagrid, another
cell in the datagrid is filled with a value....
|
by: Jonathan Upright |
last post by:
Greetings to anyone who can help:
I'm using WebMatrix to make ASP.NET pages, and I chose the "Editable
DataGrid" at the project selector screen. As you may know, it defaults
to the Microsoft...
|
by: Earl |
last post by:
I want to fire a database update off of a single change to a single cell in
the datagrid. This apparently cannot be done using keypress, keyup, keydown,
etc. I've read George Shepard's FAQ and...
|
by: Erik |
last post by:
Why isn't my update method getting called?
Pasted below is an aspx from a 1.1 application I'm working on. It has
two textboxes and a button for inserting data into the database, and a
datagrid...
|
by: Faith0G |
last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
|
by: ryjfgjl |
last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: aa123db |
last post by:
Variable and constants
Use var or let for variables and const fror constants.
Var foo ='bar';
Let foo ='bar';const baz ='bar';
Functions
function $name$ ($parameters$) {
}
...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
| |