don't know what exactly is wrong
From: Chris Ellis (praiseGod777_at_RemoveThis_hotmail.com)
Date: 03/05/04
- Previous message: Sean McKaharay: "ASP.NET impersonate=true HELP!!!!"
- Next in thread: Frank Hickman: "Re: don't know what exactly is wrong"
- Reply: Frank Hickman: "Re: don't know what exactly is wrong"
- Messages sorted by: [ date ] [ thread ]
Date: Thu, 4 Mar 2004 19:03:25 -0500
Hi,
I'm attempting to store Rich Text Format data in a memo field in an
Access2000 database. I am updating from an Access97 database in which I
used the same memo field to store plain text. I am programmatically
grabbing the text, applying RTF codes to it, and then attempting to store
that data in the same memo field in the new Access2000 database. I can't
even get past the first record. I am obviously forming a bad query, but I
don't know exactly what's wrong with it (or what to do to fix it). Here is
the exact query that is failing:
INSERT INTO Notes ([Title],[Note],[Date]) VALUES ('Bara vs.
Asah','{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\
fcharset0 Arial Black;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs24 In the
beginning, God CREATED (Bara)... bara speaks of creation, but in Genesis
1:26, God spoke of MAKING man in His image... make = Asah, which puts more
emphasis on fashioning that which is created... so, God created the
universe, but He is fashioning us into His image. Asah also deals with
refinement.\\par\r\n}\r\n\0',NULL);
sorry for that giant heap of garbage, but I do string concatenation to get
it how I want it. If it were all broken apart correctly, to be more
readable, it would look like this:
INSERT INTO
Notes
(
[Title],
[Note],
[Date]
)
VALUES
(
'Bara vs. Asah',
'{\\rtf1\\ansi\\ansicpg1252\\deff0\\deflang1033{\\fonttbl{\\f0\\fnil\\fchars
et0 Arial Black;}}\r\n\\viewkind4\\uc1\\pard\\f0\\fs24 In the beginning, God
CREATED (Bara)... bara speaks of creation, but in Genesis 1:26, God spoke of
MAKING man in His image... make = Asah, which puts more emphasis on
fashioning that which is created... so, God created the universe, but He is
fashioning us into His image. Asah also deals with
refinement.\\par\r\n}\r\n\0',
NULL
);
The Title field is a Text field with a field size of 30
The Note field (which I'm sure is where the problem must be) is a Memo field
And the Date field is a Date/Time field set to General Date and is not
required.
I am programming in C# and I'm using the OleDb objects (which is why I
posted here). I originally posted this message to
microsoft.public.access.queries. Someone replied and told me that the query
worked just fine. I opened access and pasted my query text in as a query
and it ran perfectly, inserting the proper values into my table. So, I now
assume that this must be a problem with my usage of OleDb. I am developing
in Visual Studio 2003. I am constructing an OleDbCommand object with the
above query, and calling the ExecuteNonQuery method and I get the following
exception:
System.Data.OleDb.OleDbException: Syntax error in string in query expression
''{\rtf1\ansi\ansicpg1252\deff0\deflang1033{\fonttbl{\f0\fnil\fcharset0
Arial;}}
\viewkind4\uc1\pard\fs24 In the beginning, God CREATED (Bara)... bara
speaks of creation, but in Genesis 1:26, God spoke of MAKING man in His
image... make = Asah, which p'.
at System.Data.OleDb.OleDbCommand.ExecuteCommandTextErrorHandling(Int32
hr)
at
System.Data.OleDb.OleDbCommand.ExecuteCommandTextForSingleResult(tagDBPARAMS
dbParams, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommandText(Object&
executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteCommand(CommandBehavior
behavior, Object& executeResult)
at System.Data.OleDb.OleDbCommand.ExecuteReaderInternal(CommandBehavior
behavior, String method)
at System.Data.OleDb.OleDbCommand.ExecuteNonQuery()
at HelperClasses.JetConnection.ExecuteNonQuery(String sql) in
c:\code\net\c#\helperclasses\jetconnection.cs:line 346
at HelperClasses.JetConnection.InsertRecord(String Table, String[]
Fields, Object[] Values) in
c:\code\net\c#\helperclasses\jetconnection.cs:line 226
I have no idea why. As I said, the query, copied exactly into access, runs
just fine, so I'm assuming that the problem is either in OleDb, or it's in
my use thereof. If this is not the correct newsgroup for this question,
please point me in the right direction.
Thanks in advance for any help,
Chris
- Previous message: Sean McKaharay: "ASP.NET impersonate=true HELP!!!!"
- Next in thread: Frank Hickman: "Re: don't know what exactly is wrong"
- Reply: Frank Hickman: "Re: don't know what exactly is wrong"
- Messages sorted by: [ date ] [ thread ]
Relevant Pages
|