Wrox Programmer Forums
Go Back   Wrox Programmer Forums > Microsoft Office > Access and Access VBA > Access
| Search | Today's Posts | Mark Forums Read
Access Discussion of Microsoft Access database design and programming. See also the forums for Access ASP and Access VBA.
Welcome to the p2p.wrox.com Forums.

You are currently viewing the Access section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old November 15th, 2004, 05:55 PM
Registered User
 
Join Date: Sep 2004
Location: Los Angeles, CA, USA.
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default 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.




Similar Threads
Thread Thread Starter Forum Replies Last Post
Need help in exporting memo fields to CSV file Programming_starter C# 0 May 22nd, 2006 11:25 AM
Displaying data fields from sub forms aRtware Access 5 May 8th, 2006 02:40 PM
formatting memo fields in access database fskilnik Dreamweaver (all versions) 8 February 14th, 2006 06:24 PM
Storing Data in Memo Fields! tks_muthu Classic ASP Databases 2 April 11th, 2005 02:07 AM
Memo fields takabyte Classic ASP Basics 2 October 31st, 2003 06:13 PM





Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.