473,769 Members | 2,246 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Need to update dataadapter from datagrid that doesn't contain field

I have a datagrid that is carrying all fields of a record...except one. Now
I want to update the underlying database via a dataadapter. The update is
working but the field that is "left out" is not there, of course. How do I
get that field back into the datatable for the database update?

TIA,

Larry Woods
Nov 21 '05 #1
3 1878

Why is the datagrid one record short ?
"Larry Woods" <la***@NOSPAMlw oods.com> wrote in message
news:O4******** ******@TK2MSFTN GP09.phx.gbl...
I have a datagrid that is carrying all fields of a record...except one. Now I want to update the underlying database via a dataadapter. The update is
working but the field that is "left out" is not there, of course. How do I get that field back into the datatable for the database update?

TIA,

Larry Woods

Nov 21 '05 #2
The table is created from a new row in a datagrid. The datagrid is
populated from a parameterized query. The user selects a name from a
combobox. The value is used in a parameterized query to select a group of
records related to the name (via a userid key field). Now the user adds a
record to the datagrid and I want to update the database via a dataadapter
update....BUT I need to add the userid to the new record before I write it
back to the database. That's why I need to FORCE a value into the userid
key field of the new record.

How do I do this?

TIA,

Larry Woods

"OHM ( Terry Burns )" <me@mine.com> wrote in message
news:ue******** ******@TK2MSFTN GP12.phx.gbl...

Why is the datagrid one record short ?
"Larry Woods" <la***@NOSPAMlw oods.com> wrote in message
news:O4******** ******@TK2MSFTN GP09.phx.gbl...
I have a datagrid that is carrying all fields of a record...except one. Now
I want to update the underlying database via a dataadapter. The update is working but the field that is "left out" is not there, of course. How

do I
get that field back into the datatable for the database update?

TIA,

Larry Woods


Nov 21 '05 #3
Forgive me, but this seems a bit of a strange way of going about this.

In essence, you need to bind the DataGrid to a table, then fill the table
using the parameterised query as you suggest. Adding a row to the DataGrid
will add it to the table, you can insert the UderID from the ValueMember on
the ComboBox and then run and Insert Command to add new records to the
database.

HTH



"Larry Woods" <la***@NOSPAMlw oods.com> wrote in message
news:eA******** *****@TK2MSFTNG P11.phx.gbl...
The table is created from a new row in a datagrid. The datagrid is
populated from a parameterized query. The user selects a name from a
combobox. The value is used in a parameterized query to select a group of
records related to the name (via a userid key field). Now the user adds a
record to the datagrid and I want to update the database via a dataadapter
update....BUT I need to add the userid to the new record before I write it
back to the database. That's why I need to FORCE a value into the userid
key field of the new record.

How do I do this?

TIA,

Larry Woods

"OHM ( Terry Burns )" <me@mine.com> wrote in message
news:ue******** ******@TK2MSFTN GP12.phx.gbl...

Why is the datagrid one record short ?
"Larry Woods" <la***@NOSPAMlw oods.com> wrote in message
news:O4******** ******@TK2MSFTN GP09.phx.gbl...
I have a datagrid that is carrying all fields of a record...except
one.
Now
I want to update the underlying database via a dataadapter. The
update is working but the field that is "left out" is not there, of course. How

do
I
get that field back into the datatable for the database update?

TIA,

Larry Woods



Nov 21 '05 #4

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

Similar topics

2
12668
by: Mojtaba Faridzad | last post by:
Hi, Please check these lines: DataSet dataSet = new DataSet(); dataAdapter.Fill(dataSet, "mytable"); DataRow row; row = dataSet.Tables.Rows; row.BeginEdit(); row = "555";
5
2384
by: Steve B. | last post by:
A particular column in my Access DB table, and the associated datagrid, cannot have duplicate string entries. I've selected "Yes (no duplicates)" for the Indexed Field Property of this column in the Access table. When I call update(), the DB gets updated but throws an exception saying, in affect, that I'm trying to change the key. This column is not the key. How do I handle this? How do I stop the ex.message being thrown? I guess I...
4
2012
by: CaptRR | last post by:
I think this is the right group to post to, so here goes. My problem is this, I cannot update the datarow to save my life. Been on this for 2 days now, and still am no closer to figuring it out than I was before. I'm basicly taking date from some text boxes, trying to put them into a datarow and using that datarow to update the database, but its not working. The btn_update is where I am sending the information back to the addclient...
13
2671
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. My probelm.... when I have the user press the update button (which does a post back that loops through the datagrid and updates a database) the field/cell that is filled by the javascript appears to be blank in my update code, even though I can...
3
1690
by: Wanda | last post by:
I am using vb.net and have a bounded datagrid by using SQLDataAdaptor and SQLDataSet, it does show the data when it is first loaded. But when I change the data on the datagrid, it doesn't update the database, even I use AcceptChanges... What am I missing? What I am expecting is it should update the database automatically without doing it manually with the code. Please help!!!!
1
2315
by: mivey4 | last post by:
Okay, The problem is that I have an Access Database that has the following fields: EmpID - Autonumber (PrimaryKey) AccountID - Text IssueReported - Memo DateOpened - Date/Time TimeOpened - Date/Time
11
2249
by: Siv | last post by:
Hi, I seem to be having a problem with a DataAdapter against an Access database. My app deletes 3 records runs a da.update(dt) where dt is a data.Datatable. I then proceed to update a list to reflect that the 3 items have been deleted only to discover that the 3 items appear, however when I click on them to display their information which runs a datareader over the same database it appears that the data has now gone. I wondered whether...
4
1494
by: William LaMartin | last post by:
In the past, I have filled a datagrid with data from an Access database table using a data adapter and dataset, where I used the OleDbCommandBuilder to have the program create the insert, delete and update commands automatically for the dataadapter. I think those database tables had no more than 10 or 12 fields. Then to save the changes in the datagrid to the database, I simply evoked the dataadapter update command. No problems. ...
13
2457
by: shookim | last post by:
I don't care how one suggests I do it, but I've been searching for days on how to implement this concept. I'm trying to use some kind of grid control (doesn't have to be a grid control, whatever works best) to display a dropdown menu of fields populated from table tblInvoiceData. This control also includes a textbox which the user can input a value. These two columns are side by side and not in a vertical layout. The user then clicks on...
0
9579
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However, people are often confused as to whether an ONU can Work As a Router. In this blog post, we’ll explore What is ONU, What Is Router, ONU & Router’s main usage, and What is the difference between ONU and Router. Let’s take a closer look ! Part I. Meaning of...
0
10206
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. Here is my compilation command: g++-12 -std=c++20 -Wnarrowing bit_field.cpp Here is the code in...
1
9984
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
8863
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
6662
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and then checking html paragraph one by one. At the time of converting from word file to html my equations which are in the word document file was convert into image. Globals.ThisAddIn.Application.ActiveDocument.Select();...
0
5293
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
0
5441
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
3949
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3556
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.

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.