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

Updating a DataAdapter, DataGrid after changing the database

I currently have a page which displays data in a DataGrid from a DataSet
filled by an OleDbDataAdapter. It also has buttons to carry out events which
should cause the grid contents to change (either a row is deleted or it is
changed so that the criteria of the select query no longer apply). However,
the grid does not change unless I explicitly reload the page using
Response.Redirect(Request.Url.AbsoluteUri) and I'm sure that could cause
unwanted side effects.

The current code is as follows:

oleDbConnection1.Open();
OleDbCommand cmdApp = new OleDbCommand("DELETE FROM jobs WHERE job_id =
?", oleDbConnection1);
cmdApp.Parameters.Add("job_id",
int.Parse(DataGrid1.DataKeys[e.Item.ItemIndex].ToString()));
cmdApp.ExecuteNonQuery();
oleDbConnection1.Close();
oleDbDataAdapter1.Fill(dsJobs21);
DataGrid1.DataBind();

Can anyone tell me what I'm doing wrong here?

Thanks,
Boris Zakharin
Nov 17 '05 #1
0 734

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

Similar topics

0
by: Swami | last post by:
I have a DataGrid that loads data from an Access database...I want the user to be able to edit the values, add new rows, or delete values in the data grid, and have the changes sent back to the...
1
by: Jim | last post by:
I have a dataset-bound datagrid and, when the user adds a row to the datagrid and fills it with the data, I'd like to be able to update the dataset (with the newly-added row) and then the database...
1
by: Lawanya | last post by:
I have created a dataset to select from table and display in datagrid In runtinme i am editing the datagrid..On each change i need the database content to be updated. I tried with...
0
by: Swami | last post by:
I have a DataGrid that loads data from an Access database...I want the user to be able to edit the values, add new rows, or delete values in the data grid, and have the changes sent back to the...
2
by: susan.f.barrett | last post by:
Hi, Despite me being able to type the following in to SQL Server and it updating 1 row: > updatestockcategory 1093, 839 In my code, it is not updating any rows. dataSet = new DataSet();
0
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
0
BarryA
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...
1
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...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.