473,666 Members | 2,088 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

Issues w/ using a DataTable with a TableAdapter's Update method

I created a TableAdapter (TA) in my VB 2005 project. I tested it to ensure
that its CRUD functionality is what I expected it to be.

I'm using the TA and its strongly-typed DataTable (DT) in my Wizard.
Initially, I populate the DT using the TA.GetData.

I pass the DT to a ASCX-styled control that 'pivots' (turns years into
columns) the data into a new DataTable (DT2), then binds it (DT2) to a
GridView form. I save the original DT in the viewstate. So far so good.

When I want to save the data, I compare the values in GridView to the DT
that has been retrieve from the viewstate. The DT's rows are modified
accordingly. So far so good.

However, when I attempt to use the TA's Update method, passing the DT, I get
an error about a missing parameter. I'm assuming that the parameter's value
is supplied by the field that has a matching name. I've noticed that each
row has a value in this field.

What am I missing here?

Another oddity, perhaps. If don't make an changes in the pivot grid, there
won't be any changes to the DT. Why is it that the each row's rowstate is
'modified'? Could this be related my the Update issue?

Thanks in advance.

Craig Buchanan
Jul 17 '08 #1
1 2185
Solved my own problem.

The first issue related to the parameter collection for the InsertCommand
and UpdateCommand. While the ParameterName was correct, the SourceColumn's
value didn't match the value in the DataTable. One needs to review the
parameter collection more closely after changing the command's CommandText.
Once the parameters were corrected, the TableAdapter's Update command worked
correctly.

The second issue related to how I was assigning values to each row in the
DT. I changed the logic to only change the field's value if the new value
(supplied by a TextBox) differed. As a result, the rowstates reflected what
I would expect.

Hope this helps someone.

"Craig Buchanan" <so*****@micros oft.comwrote in message
news:%2******** ********@TK2MSF TNGP04.phx.gbl. ..
>I created a TableAdapter (TA) in my VB 2005 project. I tested it to ensure
that its CRUD functionality is what I expected it to be.

I'm using the TA and its strongly-typed DataTable (DT) in my Wizard.
Initially, I populate the DT using the TA.GetData.

I pass the DT to a ASCX-styled control that 'pivots' (turns years into
columns) the data into a new DataTable (DT2), then binds it (DT2) to a
GridView form. I save the original DT in the viewstate. So far so good.

When I want to save the data, I compare the values in GridView to the DT
that has been retrieve from the viewstate. The DT's rows are modified
accordingly. So far so good.

However, when I attempt to use the TA's Update method, passing the DT, I
get an error about a missing parameter. I'm assuming that the parameter's
value is supplied by the field that has a matching name. I've noticed
that each row has a value in this field.

What am I missing here?

Another oddity, perhaps. If don't make an changes in the pivot grid,
there won't be any changes to the DT. Why is it that the each row's
rowstate is 'modified'? Could this be related my the Update issue?

Thanks in advance.

Craig Buchanan

Jul 18 '08 #2

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

Similar topics

5
12230
by: John Richardson | last post by:
I've been bothered for some time about my DataGrid not populating my rows very quickly. I have about 10K rows loading into the grid. I create a datatable dt with 2 columns, an ID and a display. The ID is a member of the keys array. I then create a DataView dv over the table, and sort it by Display and ID column (in case of duplicate Display). I then set my DataGrid.DataSource = dv; I then load the datatable with my rows, and this is...
3
2752
by: VJ | last post by:
I have 2 datasets, each with a DataTable. Each table has the same primary key, and columns. I am trying to copy rows from one dataset to another, based on an event from my application. It all works fine when the row is not present in the destination DataTable. Now when the row is present in the destination file, the .NET documentation says use the LoadRowData method of the dataset to copy the row. When do this, I get a unique key...
8
5089
by: GaryDean | last post by:
In an 2.0 asp app I used vs.net 2005 to create a TableAdapter:Dataset in my App_code directory. I also created a new vb class in that same directory. I have two issues: 1. I notice that there are errors in the xml code for the dataset... <TableAdapter BaseClass="system.ComponentModel.Component" DataAccessorModifier... the DataAccessorModifier is underlined as an error - if I hover over it, it says that attribute is not declared. ...
7
1506
by: igotyourdotnet | last post by:
Ok, I have my first full blown .NET 05 web application 99.9% complete except for these 2 issues. can anyone help me out? 1) If a page gets and error and the user clicks on the menu it takes them back to the login screen. How can I prevent that from happening? If they see the 'user friendly" error page I want them to be able to click another menu option and go to that page without going back to the login screen. (I'm not using the...
2
1079
by: GaryDean | last post by:
With ASP.Net 2.0 applications I am used to accessing data by using a 2.0 dataset and using the dataset wizard to create the tableadapter. I always (until now) have specified creation of embedded SQL instead of Stored Procedures. This always generates a GetData method and then I use something like the following code to get the data... RCustByFranIDTableAdapter myAdapter = new RCustByFranIDTableAdapter(); DataTable myTable = new...
3
2001
by: Icemokka | last post by:
Hi, I've got a table in MsAccess with 100+ fields. If I fill a tabletable with this table , change some values , get the update-command via commandbuilder , the update fails. This because the commandbuilder adds a where clause that contains all the fields in the datatable ( to check whether the record has been changed since the fill ). Because MSAccess does not allow more then 99 fields in the where clause, the update fails offcourse.
0
1235
by: Tony Johansson | last post by:
Hello! Is it always that a TableAdapter and a DataTable is a pair. When I use the Dataset Designer and create a sql clause a TableAdapter and a DataTable is created which act like a pair. I mean when you have a TableAdapter you must always have a corresponding DataTable for this TableAdapter. Is it right what I have written here?
0
1043
by: =?Utf-8?B?Q3JhaWcgQnVjaGFuYW4=?= | last post by:
Assuming that I have a table with a single, auto-generated primary key and a TableAdapter/DataTable that references it, what would happen if I add a new row to the DataTable in code, Delete it, then pass it to the TableAdapter's Update method? Would calling AcceptChanges have an effect on this? I'm building a wizard that allows the user to enter information into a gridview. the gridview's rows and columns are dynamically generated based...
6
2938
by: insirawali | last post by:
Hi all, I have this problem, i need to know is there a way i cn use the data adapter's update method in this scenario. i have 3 tables as below create table table1{ id1 int identity(1,1) Constraint pk_table1 Primary Key,
0
8449
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
8360
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 effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
8784
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 tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
8556
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
7387
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...
1
6198
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes instead of User Defined Types (UDT). For example, to manage the data in unbound forms. Adolph will...
0
4198
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...
1
2774
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
2011
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.