dbctrls: DBEdit controls: How do you set this up correctly? lazarus / 16-Databases ---------------------------------------------------------------------- jshand2010 · 2013-02-28 22:27 i have enclosed a picture of my ffirstlogin form.  can you let me know what's wrong?  every time i try to put data into a dbedit box and change to another dbedit box, (memo) is always put back in there. thanks again ---------------------------------------------------------------------- BigChimp · 2013-03-01 06:10 Why don't I upload a picture of my cat and you can tell me why it's losing hair? In other words, please read this: http://wiki.lazarus.freepascal.org/Lazarus_Faq#What_is_the_correct_way _to_ask_questions_in_the_forum.3F ---------------------------------------------------------------------- jshand2010 · 2013-03-01 07:56 I have enclosed my source code and settings.  please let know if anything needs to be changed, because i want to be able to view data from the db  into the dbtext box and actually edit that information ---------------------------------------------------------------------- BigChimp · 2013-03-01 09:50 Well, you missed out the database DDL so I didn't bother to try guessing what database schema you used... (however the memo should have been an obvious hint edit: sorry I missed that, glad taazz caught it in the other thread) See http://wiki.lazarus.freepascal.org/Database_bug_reporting#Reporting_bu gs Probable solution for your problem: http://lazarus.freepascal.org/index.php/topic,20091.msg115368.html#msg 115368 ---------------------------------------------------------------------- jshand2010 · 2013-03-01 21:28 what is a database DDL?  schema??  Is this really a bug or is it to do with how i set it up?? ---------------------------------------------------------------------- taazz · 2013-03-02 03:42 DDL = Data definition Language. it is the sql file that creates the databases and the objects in it (tables, fields, views etc). Most of the data aware components work as expected. you seem to connect a tdbedit to a database memo field, a memo field is a string type field which has no upper limit on how many characters you put in to it, something like a blob but for text. Those type fields require special handling since the database client can not read their data  in a single row response from the server so a TDBMemo is required which knows how to read and update them. ---------------------------------------------------------------------- jshand2010 · 2013-03-03 04:48 thanks for your help taaz, but i'm even more confused.  i can't seem to find the right documentation on how to set this up properly 1.  i have a successful connection to the database with the TPQConnection module. 2.  i have a successful connection with the TSQLQuery module.  have managed to set it to Active:=true without any problems. 3.  i have a successful connection with the TSQLTransaction module. 4.  The TDatasource module is connected to TSQLQuery.  The TSQLQuery is only connected to DataBase which is 'conn' and transaction is connected to trans. also in query i have the useprimarykey set to false. For the database i have a table created like so: create table login(   username varchar[10] not null,   password varchar[50] not null ); now, where am i going wrong?  i am now getting frustrated with it. ---------------------------------------------------------------------- taazz · 2013-03-03 06:52 My experience with PostreSQL is limited, but your DDL script is a bit unusual at least, what you are trying to do? eg with UserName you are trying to have a varchar of max length 10 for user name or have a varchar array of 10 positions? in any case a varchar with max length of 10 is declared like this Code: [Select]create table login(   username varchar(10) not null,   password varchar(50) not null ); The "()" pair is used for length definition the "[]" pair is used for array definition. Try the SQL I posted and see if that solves your problems. ---------------------------------------------------------------------- jshand2010 · 2013-03-03 08:24 thanks for your help.  it was how the database was set up.  i should have remembered that.  i'm running into another problem. i can not utilize my primary key because it is a type of number and a type of text.  what a load of crap.  why am i having so much trouble??  i can't go through tutorials i get even more confused.  i have dyslexia, where i don't always understand what i read and i get paniced. thanks again ---------------------------------------------------------------------- taazz · 2013-03-03 08:52 I don't understand the details of your question but as far as I know there is no problem having a primary key based on any kind of data type except blobs and arrays of course. eg Code: [Select]create table MyProduct(   IID Bigint not null,   BarCode Varchar(20) not null,   Description varchar(100),   primary key (IID, BarCode) ); the above table has a primary key based on a character and an integer data type, it works on postgresql as far as I know. there are a few rules on primary keys that I follow. 1) primary keys are always physical fields not calculated 2) Primary keys have no business logic attach to them 3) Primary keys are not allowed on the end user application. Making sure that the primary key is an internal field only and has nothing to do with user data it makes it easier for your application to insert/edit user data in any way imaginable without having database problems  eg orphaned rows. ---------------------------------------------------------------------- jshand2010 · 2013-03-04 03:13 Thanks taazz, i have decided against using dbedit.  just using standard controls, but using query.fields[0].asstring commands to edit and read from the database.  now work without a problem.  dbctrls, dbedit controls etc, are very confusing.  just can't understand how to get them working.  i would like a more direct relationship with the database, but have to stick to bidirectional for now. thanks again