TSQLQuery.Insert How to use this? lazarus / 16-Databases ---------------------------------------------------------------------- jshand2010 · 2013-02-28 22:07 Hi there.  i have dbctrls on my form with two dbedit boxes.  i am wondering how to use the insert command.  for example query.Insert thanks again ---------------------------------------------------------------------- goodname · 2013-02-28 22:34 Your dbctrls should be linked with a Tdatasource. The Tdatasource should be linked with a TSQLQuery. The TSQLQuery should then have a SQL 'Select' statement. The dbctrls then get the datafield from the SQL statement. Executing query.Insert in a form event creates a new local record. Saving that record to the database is another step that can be found through the following wiki documents. http://wiki.freepascal.org/SQLdb_Tutorial1 http://wiki.freepascal.org/Working_With_TSQLQuery http://wiki.freepascal.org/SqlDBHowto ---------------------------------------------------------------------- jshand2010 · 2013-03-01 07:59 i have set up the database controls like you have mentioned.  i still have no understanding as to why (memo) is written in each of those dbedit box controls. ---------------------------------------------------------------------- taazz · 2013-03-01 08:02 Because the database field is declared as a blob of type string eg the Text data type in PostgreSQL. ---------------------------------------------------------------------- jshand2010 · 2013-03-01 08:07 so i guess i have it set up correctly.  How do you remove those horrible (memo) blobs?? ---------------------------------------------------------------------- taazz · 2013-03-01 09:27 The easy solution is to use a TDBMemo control instead of a TDBEdit, The long winded solution is to work your way through the fields of a dataset and write code to events like gettext settext etc to allow for what ever  manipulation you need. take a look at teh following discussion it should give some pointers on the right direction. http://forum.lazarus.freepascal.org/index.php/topic,18185.0.html ---------------------------------------------------------------------- BigChimp · 2013-03-01 09:48 Or presumably define it as a varchar in PostgreSQL... ---------------------------------------------------------------------- goodname · 2013-03-01 13:35 Another way is to have the query cast the text field to a varchar(255). If you really want fields that are longer then 255 characters this will not work. SELECT CAST(txtfld AS varchar(255))AS fld FROM tbl;