|
-
August 31st, 2009, 05:24 PM
#1
[RESOLVED] problem with updating a datatable
using 3.5 .net
here is my connection related code (i know it works at least partially, as it allows me to read data from the table, and to recognize the columns before the dataadapter.update command).
public partial class Edit_Subjects : Form
{
OleDbConnection m_cnADONetConnection = new OleDbConnection();
OleDbDataAdapter m_daSubjectDataAdapter;
OleDbCommandBuilder m_cbSubjectCommandBuilder;
DataTable m_Subjects = new DataTable();
private void Edit_Subjects_Load(object sender, EventArgs e)
{
m_cnADONetConnection.ConnectionString =
@"Provider=Microsoft.Jet.OLEDB.4.0;Data Source=C:\temp\testing.mdb";
m_cnADONetConnection.Open();
m_daSubjectDataAdapter = new OleDbDataAdapter("Select * From Subject", m_cnADONetConnection);
m_daSubjectDataAdapter.Fill(m_Subjects);
When i try to add a row, using
DataRow drNewrow = m_Subjects.NewRow();
m_Subjects.Rows.Add(drNewrow);
m_daSubjectDataAdapter.Update(m_Subjects);
to do so, i receve an error:
"Syntax error in INSERT INTO statement" (unhandled OledbException)
I also receive errors when i try to edit or delete rows.
Can someone please find the error?
Thank you very much.
Tags for this Thread
Posting Permissions
- You may not post new threads
- You may not post replies
- You may not post attachments
- You may not edit your posts
-
Forum Rules
|
Click Here to Expand Forum to Full Width
|