Board index » delphi » tDBRichEdit and SQL insert and update statements
lrgood
![]() Delphi Developer |
Tue, 12 Oct 2004 02:44:06 GMT
|
lrgood
![]() Delphi Developer |
Tue, 12 Oct 2004 02:44:06 GMT
tDBRichEdit and SQL insert and update statements
I wated to perform an insert or update to a richedit field in a DB using an
SQL statement. As far as I can figure out, the SQL property in a tquery can not handle the control characters in the richedit field.. Is there anyway to do an insert or update using an SQL statement -- |
Team
![]() Delphi Developer |
Tue, 12 Oct 2004 05:22:57 GMT
Re:tDBRichEdit and SQL insert and update statementsUse a parameterized query. What database are you using? -- |
lrgoo
![]() Delphi Developer |
Tue, 12 Oct 2004 06:37:00 GMT
Re:tDBRichEdit and SQL insert and update statementsI am using paradox. I thought the problem was in the SQL "string" with single quotes. how will The control charcters, x10 and x 13 are surrounded by quotes in richedit and I have replaced the queries with appends and inserts which work fine. The problem was that I had writen some general methods which worked for "Bill Todd (TeamB)" <bill_nos...@dbginc.com> wrote in message Quote> Use a parameterized query. What database are you using? |
Team
![]() Delphi Developer |
Tue, 12 Oct 2004 07:46:00 GMT
Re:tDBRichEdit and SQL insert and update statementsYou have lost me. If you are using a TDBRichEdit you do not need to use SQL to save the memo to the table. You need to use a Binary field in the Paradox table. If you want to to insert the rich text with SQL use a TRichEdit and assign its Text property to the query parameter. -- |
lrgoo
![]() Delphi Developer |
Tue, 12 Oct 2004 20:31:29 GMT
Re:tDBRichEdit and SQL insert and update statementsI often hesitate to fully disclose what I am doing, simply because I do not understand the implications of everything and I do not want to take up your time with extraneous information. I am using tClientDataset, tDatasetProvider and a tquery to show info. The RichEdit field is in the "Tests" table. A generalized comment field. A The error comes back as an error in the Set Comments = "" statements. In My goal was to only use tdbRichEdit and the SQL statements to handle my DB "Bill Todd (TeamB)" <bill_nos...@dbginc.com> wrote in message Quote> You have lost me. If you are using a TDBRichEdit you do not need to use |
Team
![]() Delphi Developer |
Tue, 12 Oct 2004 22:36:44 GMT
Re:tDBRichEdit and SQL insert and update statementsSince you are using Paradox tables I would expect '#$D#$A' to work if enclosed in double quotes. However, if you use a parameter to hold the value in the update query it should certainly work. Once again, I assume you are using a field of type Binary to hold the data in your Paradox table. If no, that may be the problem. -- |
lrgoo
![]() Delphi Developer |
Wed, 13 Oct 2004 00:16:20 GMT
Re:tDBRichEdit and SQL insert and update statementsBill The db datatype is Formatted Memo so it is a blob. I tried the double quotes but that does not work. The single quotes are The problem is not with the DB. The problem is with interpreting single and I think we have beat on this one enough. It is time for me to move on Thanks for your time and help "Bill Todd (TeamB)" <bill_nos...@dbginc.com> wrote in message Quote> Since you are using Paradox tables I would expect '#$D#$A' to work if |
Team
![]() Delphi Developer |
Wed, 13 Oct 2004 00:21:10 GMT
Re:tDBRichEdit and SQL insert and update statementsI don't know how to say this more clearly. You _must_ use the Binary field type. You cannot use Formatted Memo, Memo or any other blob field type except binary to store RTF. Formatted Memo is a field type that is supported by the Paradox product only, not by Delphi. Formatted Memo fields expect and check for a very specific proprietary undocumented data format that is used only by the Paradox product marketed by Corel. If you try to put characters that are not part of the proprietary formatted memo specification into a formatted memo field you wil have errors. -- |
lrgoo
![]() Delphi Developer |
Wed, 13 Oct 2004 02:51:02 GMT
Re:tDBRichEdit and SQL insert and update statementsBill I looked at your comment about binary as generic, that is binary as in thank you for the clarification. "Bill Todd (TeamB)" <bill_nos...@dbginc.com> wrote in message Quote> I don't know how to say this more clearly. You _must_ use the Binary field |
lrgoo
![]() Delphi Developer |
Wed, 13 Oct 2004 03:39:18 GMT
Re:tDBRichEdit and SQL insert and update statementsBill I switched the field type to Binary in the paradox db as you suggested and "{\rtf1\ansi\ansicpg1252\deff0{\fonttbl{\f0\fnil\fcharset0 MS Sans and the sql statement is update Test SET Test."Comments" = When I try to update the DB I get an "Invalid Use of Keyword" error However both data types have no difficulty handling the string in a tTable tblTest.Edit; This leads me to believe that the type of field in the database is not where Quote"lrgood" <g...@lrgood.com> wrote in message news:3cc9a193_1@dnews... |
Team
![]() Delphi Developer |
Wed, 13 Oct 2004 09:50:36 GMT
Re:tDBRichEdit and SQL insert and update statementsMy only other suggestion is to try a parameterized query. -- |
1. Local SQL Updating/Inserting using IF statement
2. Update Memo-Column with SQL UPDATE Statement
3. Problem w/SQL Insert statement, SQL Server nvarchar datatype, and colons :
4. Inserting blob into UPDATE or INSERT SQL Stmt
5. IS TADOQuery ok for insert/update/delete statements
6. Update or Insert statement to fill a BLOB field
7. Help using Update and Insert Statement in TQuery
8. Autocreating insert/update/delete statements