Click here to Skip to main content
11,934,380 members (40,386 online)
Rate this:
Please Sign up or sign in to vote.
See more: C#

i'm using visual c# 2008 xpress, sql srver 2005 xpress
the dataset is ItemDataDS

that's what i do :

SA.ItemDataDSTableAdapters.tblItemDataTableAdapter taItemData;
ItemDataDS ds = new ItemDataDS();
DataTable dt = ds.Tables[tablename];

i create and populate an array of objects ao and do : dt.LoadDataRow(ao,true);
when i check ds (debug) i find the table and in the table i find the data

finally i do :

this is done without and error but when i check the db-table no data was written

the TableAdapters insert-, update-, select- and delete-methods work as i added and updated one record with the dataset-designer.
the fill() method also works 'cause this record can be seen in the ds.

any suggestions what i'm doing wrong or what i can do analyze the problem ?
thanks in advance
Posted 9-Feb-13 12:20pm
Edited 8-Apr-13 3:35am
Joezer BH38.4K
Krunal Rohit 9-Feb-13 23:11pm
Provide all the code !
Rate this: bad
Please Sign up or sign in to vote.

Solution 1

fheyn 10-Feb-13 7:12am
sorry, but this isn't very helpfull.
all that stuff seven or eight times before in the last ten days.
i built a new testproject from scratch this morning and it gets the same problem.
there is already some data in the db and i can retrieve it without any problem, but i can't neither insert nor update (delete i havn't tried, bet delete's gonna work).
Mehdi Gholam 10-Feb-13 8:56am
Start with the sample that works, then compare your work with that.
Rate this: bad
Please Sign up or sign in to vote.

Solution 3


You might need to set the insert, update and delete command for your dataadapter.

SqlCommandBuilder cmdbuilder;
cmdbuilder = new SqlCommandBuilder(dataAdapt);
dataAdapt.DeleteCommand = cmdbuilder.GetDeleteCommand(true);
dataAdapt.UpdateCommand = cmdbuilder.GetUpdateCommand(true);
dataAdapt.InsertCommand = cmdbuilder.GetInsertCommand(true);

Best Regards
fheyn 12-Feb-13 16:27pm
i don't use dataAdapter
Rate this: bad
Please Sign up or sign in to vote.

Solution 4

You might want to use sqlcommandbuilder.

SqlDataAdapter m_DataAdapter;           /* data adapter */
ItemDataDS ds = new ItemDataDS();       /* dataset */
DataTable dt = ds.Tables[tablename];    /* datatable */
SqlCommandBuilder m_ComBuilder;         /* command builder */
private void LoadData()                 /*populate your dataset*/
 m_DataAdapter = new SqlDataAdapter("Select ... from ..",Connection)

... add row or make changes on your datatable

private void SaveChanges()              /* Save all changes made */
m_ComBuilder = new SqlCommandBuilder(m_DataAdapter);
Rate this: bad
Please Sign up or sign in to vote.

Solution 5

this is the solution :


with AcceptChanges-flag set TRUE, there is NO update !

don't mind the message board's message

i didn't solve it myself !

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)

  Print Answers RSS
Top Experts
Last 24hrsThis month

Advertise | Privacy | Mobile
Web01 | 2.8.151126.1 | Last Updated 8 Apr 2013
Copyright © CodeProject, 1999-2015
All Rights Reserved. Terms of Service
Layout: fixed | fluid

CodeProject, 503-250 Ferrand Drive Toronto Ontario, M3C 3G8 Canada +1 416-849-8900 x 100