BorlandTalk.com Forum Index BorlandTalk.com
Borland discussion newsgroups
 
Archives   FAQFAQ   SearchSearch   MemberlistMemberlist   UsergroupsUsergroups   RegisterRegister 
 ProfileProfile   Log in to check your private messagesLog in to check your private messages   Log inLog in 

edit and/or insert records in TADODataset

 
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO)
View previous topic :: View next topic  
Author Message
Sven Pran
Guest





PostPosted: Mon Oct 16, 2006 1:15 am    Post subject: edit and/or insert records in TADODataset Reply with quote



I have a table from an Access database displayed in a
DBGrid. I am using the components: TADOConnection,
TADODataSet, TDataSource, TDBGrid and TDBNavigator,
and my platform is BDS2006 for Win32.


DBNavigator allows me to delete a selected record.
It also allows me to insert a new record but I have so far
found no way to enter data into any of the fields in this
new record and when I try to complete the action I get the
obvious message that I cannot insert a record without any
data.

I suppose it is the same problem when I have not found
any way of editing the data in a field in a selected
record. (I do it with SQL UPDATE statements on the table
as a whole, but in some cases I need to do it on individually
selected record fields like editing cells in a datasheet.)

I should appreciate some "quick-start" advice, both on
how to select a field rather than the complete row in
DBGrid, and also on how to edit record fields.

regards Sven
Back to top
Bill Todd
Guest





PostPosted: Mon Oct 16, 2006 3:33 am    Post subject: Re: edit and/or insert records in TADODataset Reply with quote



I have not worked with Acess for years but you should be able to edit
data in the DBGrid by selecting a cell and typing. Make sure that the
AutoEdit property of the DataSet is set to true (the default). If you
cannot enter data in a new record or change data in an existing record
tell us exactly what happens when you try to do so including the exact
text of any error message.

--
Bill Todd (TeamB)
Back to top
Bill Todd
Guest





PostPosted: Mon Oct 16, 2006 6:15 am    Post subject: Re: edit and/or insert records in TADODataset Reply with quote



Also, if you cannot edit post your SQL SELECT statement and the
metadata for the table.

--
Bill Todd (TeamB)
Back to top
Sven Pran
Guest





PostPosted: Mon Oct 16, 2006 8:10 am    Post subject: Re: edit and/or insert records in TADODataset Reply with quote

"Bill Todd" <no (AT) no (DOT) com> wrote in message
news:4532b734$1 (AT) newsgroups (DOT) borland.com...
Quote:
I have not worked with Acess for years but you should be able to edit
data in the DBGrid by selecting a cell and typing. Make sure that the
AutoEdit property of the DataSet is set to true (the default). If you
cannot enter data in a new record or change data in an existing record
tell us exactly what happens when you try to do so including the exact
text of any error message.

--
Bill Todd (TeamB)

Thanks,

Initially I have probably overlooked something in the properties of
DBGrid because I can only select the whole row, not an individual cell.

These are the DBGrid options selected: (More or less default)
Options = [dgTitles, dgIndicator, dgColumnResize, dgColLines,
dgRowLines, dgTabs, dgRowSelect, dgConfirmDelete, dgCancelOnExit]

In the ADODataset definition I now have CommandType = cmdTableDirect,
I have tried cmdTable and cmdText with SQL select statements, for
instance SELECT * FROM tablename.

Anything not mentioned here is probably irrelevant for my "problem"
(like font and title specifications) or default in BDS2006

I shall be away for a week, probably unable to look up answers until Friday.

regards Sven
Back to top
Bill Todd
Guest





PostPosted: Mon Oct 16, 2006 5:42 pm    Post subject: Re: edit and/or insert records in TADODataset Reply with quote

Remove dgRowSelect.

--
Bill Todd (TeamB)
Back to top
Sven Pran
Guest





PostPosted: Fri Oct 20, 2006 3:12 pm    Post subject: Re: edit and/or insert records in TADODataset Reply with quote

"Bill Todd" <no (AT) no (DOT) com> wrote in message
news:45337e34$1 (AT) newsgroups (DOT) borland.com...
Quote:
Remove dgRowSelect.

--
Bill Todd (TeamB)

Right!
I have been away for some days and one evening I
sat down with my computer to see if I could get any
further.

Suddenly I got the idea first to remove dgRowSelect
which did not help. Then I noticed dgEditing which I
could not make "true" and finally I combined the two
changes.

Thanks for your help!

regards Sven
Back to top
Display posts from previous:   
Post new topic   Reply to topic    BorlandTalk.com Forum Index -> Delphi Databases (ADO) All times are GMT
Page 1 of 1

 
Jump to:  
You cannot post new topics in this forum
You cannot reply to topics in this forum
You cannot edit your posts in this forum
You cannot delete your posts in this forum
You cannot vote in polls in this forum


Powered by phpBB © 2001, 2006 phpBB Group
SEO toolkit © 2004-2006 webmedic.