---
title: "Unable to add new entry in datatable c#"  
description: "Unable to add new entry in datatable c#"  
author: "Anonymous User"  
published: 2013-06-19  
updated: 2013-06-19  
canonical: https://www.mindstick.com/forum/1203/unable-to-add-new-entry-in-datatable-c-sharp  
category: "ado.net"  
tags: ["ado.net"]  
reading_time: 1 minute  

---

# Unable to add new entry in datatable c#

Hi [Expert](https://www.mindstick.com/articles/13120/an-expert-financial-advice-will-improve-your-finances),\
i'm [trying](https://answers.mindstick.com/qa/93698/6-mistakes-couples-are-trying-to-save-money) to add a new row to my [datatable](https://www.mindstick.com/blog/195/datatable-in-ado-dot-net).\
I've no [error while running](https://www.mindstick.com/forum/159405/how-to-solve-an-out-of-memory-error-while-running-a-resource-intensive-application) this code but nothing happened in my table.\
Here's my code :\
**[string](https://www.mindstick.com/articles/1527/string-split-in-c-sharp) table = "`DONNEE ENTRANT`";** **OleDbDataAdapter adapter = new OleDbDataAdapter("[SELECT](https://www.mindstick.com/forum/160534/orderby-then-select-vs-select-then-orderby-performance) * From " + table, _conn);** **OleDbCommandBuilder cmdBuilder = new OleDbCommandBuilder(adapter);****\** **DataTable dataTable = new DataTable(table);** **adapter.Fill(dataTable);** **DataRow row = dataTable.NewRow();****\** **row["CODE LIAISON"] = "TEST";****\** **dataTable.Rows.Add(row);** **dataTable.AcceptChanges();****\** **adapter.Update(dataTable);**\
Any idea what i'm [doing wrong](https://answers.mindstick.com/qa/36736/what-are-indians-doing-wrong-on-whatsapp) (in this way, I know that we can [run command](https://www.mindstick.com/blog/478/run-command-shortcut-keys) with oleDb but really don't like this way ...).\
Thanks

## Replies

### Reply by Anonymous User

Hi Expert,\
So remove this line:\
**dataTable.AcceptChanges();**\
because that's changing the RowState to Unchanged and you need it left at Added. Further, you need to make sure that your adapter has an InsertStatement defined so it can use it.\
Thanks in advance.


---

Original Source: https://www.mindstick.com/forum/1203/unable-to-add-new-entry-in-datatable-c-sharp

Copyright © MindStick Software Pvt. Ltd. This Markdown version is provided for developers, AI systems, and offline reading.
