Memo Fields with Windows Forms in C#
Hello all,
I'm writing a single-user Windows Forms app with Access as a database back end, reading and writing from XML files. I've loaded all my tables with the exception of tables containing memo fields - for some reason, I can't populate them with C# code. The memos are at the end of the table (I've seen that error report), and the code goes something like this:
private void LoadExceptionDays(XmlNode node)
{
DataRow insertRow;
if (conn == null) return;
OleDbCommand cmd = new OleDbCommand("SELECT calendarID, exceptionDay, isShootDay, note FROM calendarExceptionDays", conn);
DataSet temp = new DataSet();
if (adapter != null) adapter.Dispose();
adapter = new OleDbDataAdapter();
adapter.SelectCommand = cmd;
OleDbCommandBuilder custCB = new OleDbCommandBuilder(adapter);
adapter.Fill(temp);
DataTable tbl = temp.Tables[0];
foreach (XmlNode n in node.ChildNodes)
{
insertRow = tbl.NewRow();
insertRow["calendarID"] = n["calendarID"].InnerText;
insertRow["exceptionDay"] = n["exceptionDay"].InnerText;
insertRow["isShootDay"] = n["isShootDate"].InnerText;
// memo field below
insertRow["note"] = n["note"].InnerText;
tbl.Rows.Add(insertRow);
}
try
{
adapter.Update(tbl);
}
catch (Exception ex)
{
System.Windows.Forms.MessageBox.Show(ex.ToString() );
}
}
When I run the above code, I get a "syntax error in INSERT INTO statement" when adapter.Update() is called. Commenting the memo field eliminates the error. Any idea what I'm doing wrong?
Thanks in advance
Jim Stanley
Media Services, Inc.
Jim Stanley
Media Services, Inc.
|