Questions tagged [tableadapter]

a .Net component, that fills a dataset with data from the database.

TableAdapter is a component, that fills a with data from the database.

505 questions
54
votes
21 answers

How to delete a selected DataGridViewRow and update a connected database table?

I have a DataGridView control on a Windows Forms application (written with C#). What I need is: when a user selects a DataGridViewRow, and then clicks on a 'Delete' button, the row should be deleted and next, the database needs to be updated using…
Woody
  • 1,159
  • 3
  • 15
  • 25
18
votes
12 answers

Update requires a valid UpdateCommand when passed DataRow collection with modified rows

So I had this working last week. At least, I thought I did! DataGridView Update Then I start working on the project again today and am getting Update requires a valid UpdateCommand when passed DataRow collection with modified rows. On…
Sam
  • 7,543
  • 7
  • 48
  • 62
11
votes
1 answer

How do you read a byte array from a DataRow in C#?

I have a DataSet with a DataTable that correctly fills a single DataRow through a TableAdapter. I am able to pull data from the DataRow with code like this: dataFileID = (int)this.dataFileDataRow["DataFileID"]; dataFileName =…
Keith Sirmons
  • 8,271
  • 15
  • 52
  • 75
8
votes
2 answers

Failed to enable constraints. When using a data table adapter

I'm getting Failed to enable constraints. One or more rows contain values violating non-null, unique, or foreign-key constraints. for the following query in my table adapter. select f.id, f.name, p.productid, p.masterproductID, f.productid,…
Maxx
  • 3,925
  • 8
  • 33
  • 38
7
votes
4 answers

Incorrect ID is returned after insert using TableAdapter

When I perform an insert with TableAdapter: int pid = this.purchaseTableAdapter.Insert(supplierid, datetime, "", totalprice, amountpaid); It returns the incorrect id 1 while it should return 15. How to get the correct ID?
SMUsamaShah
  • 7,677
  • 22
  • 88
  • 131
7
votes
4 answers

TableAdapter wizard does not have connection string from Settings in pick list

C# VS 2010 .net v4.0 I add a DataSet to my project (Class Library) and when I try to add a TableAdapter the connection string that I have added to Settings is not available to select. I have connection strings for other datasources (from server…
Crowcoder
  • 11,250
  • 3
  • 36
  • 45
7
votes
1 answer

Failed to convert parameter value from string to guid

I have a tiered application. The datalayer makes a call to the database by using a dataset which contains a tableadapter. In the database table there is a field called ID of type UniqueIdentifier. I then create the following query: select * from tbl…
user1404780
6
votes
5 answers

What happened to my TableAdapter's Update and Delete commands?

I am fighting a recalcitrant VS2008 DataSet designer, it seems. I have been trying to do what seems to be a simple 2-table dataset solution, where one table is simply the textual meaning for an integer value stored in the other table. Basic data…
DaveN59
  • 3,638
  • 8
  • 39
  • 51
6
votes
4 answers

ADO.NET TableAdapter parameters

I have a query that I wish to run through an ASP.NET TableAdapter that contains an 'IN' clause which is to receive it's values through a parameter. My question is, how do I specify this parameter? I thought of writing the conditional statement like…
Ian Devlin
  • 18,534
  • 6
  • 55
  • 73
4
votes
4 answers

Control TableAdapter Command Timeout Globally

I have a DataSet with a QueriesTableAdapter. In order to control the SqlCommand.CommandTimeout I've added a partial class called QueriesTableAdapter with a public method called ChangeTimeout. partial class QueriesTableAdapter { public void…
Billy Coover
  • 3,827
  • 5
  • 36
  • 50
4
votes
3 answers

Managing DB Changes in a C# Project

I have a C# app (in VisualStudio 2010) that used SqlServer 2005 accessed through TableAdapters in C#. I haven't discovered a good way to manage DB changes. For example, in my next release I have a bunch of db schema changes. I made all of my DB…
Joda Maki
  • 5,649
  • 6
  • 27
  • 36
4
votes
0 answers

How do I export data from a datagridview/data set into an Access Database? [C#]

So my title is pretty self explanatory, so thus far I have read Microsofts Documentation and watched some Youtube videos regarding my issue here. Firstly my project code here: using System; using System.Collections.Generic; using…
4
votes
3 answers

Invalid object name 'dbo.Item'

I'm kind of new to C# and am trying out the convenient looking adaper-dataset combo with local database. while I was amazed at how easy and useful it was I stumbled upon an issue: Whenever I try to fill the Item table with the adapter I get Invalid…
Tim
  • 165
  • 3
  • 9
4
votes
3 answers

How to check that a delete / update operation completed successfully when using a stored procedure?

Say we have stored procedure(s) performing simple operations like this: CREATE PROCEDURE [dbo].[AddNewAuthorReturnID] ( @Author_Name VARCHAR(MAX), @Author_ID int OUTPUT ) AS SET NOCOUNT OFF; BEGIN INSERT INTO AUTHORS…
Asad
  • 21,468
  • 17
  • 69
  • 94
4
votes
1 answer

c# strongly typed dataset whose table adapter is not returning expected result

I have a C# application (using VS 2010 premium) implementing a strongly-typed dataset that's connected to an MS Access 2003 database. I am implementing a table adapter within this dataset whose SQL script is: SELECT [ID], [Name], [Created By] FROM…
ewak
  • 51
  • 2
1
2 3
33 34