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

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 2180
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*****@microsoft.comwrote in message
news:%2****************@TK2MSFTNGP04.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
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. ...
3
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...
8
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...
7
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...
2
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...
3
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...
0
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...
0
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,...
6
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)...
0
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...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 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 former...
0
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,...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
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...
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
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
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...

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.