Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

Welcome to the new platform of Programmer's Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use its exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.

DBGrid problem - need some ideas.

Hiya fellas,

I have populated a DBGrid with a ttable and a datasource.
The dataset to the datasource is the ttable and the datasource
to the dbgrid1 is the dataset of the table.
My problem is this,
If I click on the first second third....dataset then
everything is fine. My query to populate gird2 works.
Now if I OnColClick on the last field in dbgrid1 then all
I get is a click on the field where it looks like it want me to
edit the information. It does not send the needed argument to the
query to populate dbgrid2.

I have tried findfirst..findlast..refresh, currentcursonpos..but this makes dbgrid1 jump to
that dataset and the current dataset's information displayed in
dbgrid2 is not highlighted therefore giving a missunderstanding of
the target now being used.

Any thoughts...?
thanks in advance,
rtdvoip

Comments

  • PerranPerran Posts: 241Member
    : Hiya fellas,
    :
    : I have populated a DBGrid with a ttable and a datasource.
    : The dataset to the datasource is the ttable and the datasource
    : to the dbgrid1 is the dataset of the table.
    : My problem is this,
    : If I click on the first second third....dataset then
    : everything is fine. My query to populate gird2 works.
    : Now if I OnColClick on the last field in dbgrid1 then all
    : I get is a click on the field where it looks like it want me to
    : edit the information. It does not send the needed argument to the
    : query to populate dbgrid2.
    :
    : I have tried findfirst..findlast..refresh, currentcursonpos..but this makes dbgrid1 jump to
    : that dataset and the current dataset's information displayed in
    : dbgrid2 is not highlighted therefore giving a missunderstanding of
    : the target now being used.
    :
    : Any thoughts...?
    : thanks in advance,
    : rtdvoip
    :
    :
    If I understand correctly, you're using a table to populate a dbgrid, then you want to be able to click in a cell and send that as a parameter to a query? Clicking in a cell selects that record in your table. You can then extract the field data with FieldByName or FieldValues and use that in a parameterized query. Are you doing an unprepare and prepare before opening the query? If not a parameterized query, are you clearing and adding the strings back? There are at least two ways to do what you want. If you want to post the offending code, we can look at it....can't help too much without a little more detail.
  • rtdvoiprtdvoip Posts: 30Member
    : : Hiya fellas,
    : :
    : : I have populated a DBGrid with a ttable and a datasource.
    : : The dataset to the datasource is the ttable and the datasource
    : : to the dbgrid1 is the dataset of the table.
    : : My problem is this,
    : : If I click on the first second third....dataset then
    : : everything is fine. My query to populate gird2 works.
    : : Now if I OnColClick on the last field in dbgrid1 then all
    : : I get is a click on the field where it looks like it want me to
    : : edit the information. It does not send the needed argument to the
    : : query to populate dbgrid2.
    : :
    : : I have tried findfirst..findlast..refresh, currentcursonpos..but this makes dbgrid1 jump to
    : : that dataset and the current dataset's information displayed in
    : : dbgrid2 is not highlighted therefore giving a missunderstanding of
    : : the target now being used.
    : :
    : : Any thoughts...?
    : : thanks in advance,
    : : rtdvoip
    : :
    : :
    : If I understand correctly, you're using a table to populate a dbgrid, then you want to be able to click in a cell and send that as a parameter to a query? Clicking in a cell selects that record in your table. You can then extract the field data with FieldByName or FieldValues and use that in a parameterized query. Are you doing an unprepare and prepare before opening the query? If not a parameterized query, are you clearing and adding the strings back? There are at least two ways to do what you want. If you want to post the offending code, we can look at it....can't help too much without a little more detail.
    :
    It is not so much a problem with the query. All that is working just
    fine.
    It is just when I click on DBGrid.DataSource.Dataset.First and then
    go directly to click on DBGrid.DataSource.Dataset.Last it will not
    take the value. I need to click on some other record in between.
    Same for the exact opposite situation. I should be able
    to click on the first record with not problem and then be able to click on the last record with no problem not having to select some
    record inbetween my first and last or last and first record selection.
    Just wondering how I can get around this little aggrivation.
    thanks rtdvoip

  • PerranPerran Posts: 241Member
    : : : Hiya fellas,
    : : :
    : : : I have populated a DBGrid with a ttable and a datasource.
    : : : The dataset to the datasource is the ttable and the datasource
    : : : to the dbgrid1 is the dataset of the table.
    : : : My problem is this,
    : : : If I click on the first second third....dataset then
    : : : everything is fine. My query to populate gird2 works.
    : : : Now if I OnColClick on the last field in dbgrid1 then all
    : : : I get is a click on the field where it looks like it want me to
    : : : edit the information. It does not send the needed argument to the
    : : : query to populate dbgrid2.
    : : :
    : : : I have tried findfirst..findlast..refresh, currentcursonpos..but this makes dbgrid1 jump to
    : : : that dataset and the current dataset's information displayed in
    : : : dbgrid2 is not highlighted therefore giving a missunderstanding of
    : : : the target now being used.
    : : :
    : : : Any thoughts...?
    : : : thanks in advance,
    : : : rtdvoip
    : : :
    : : :
    : : If I understand correctly, you're using a table to populate a dbgrid, then you want to be able to click in a cell and send that as a parameter to a query? Clicking in a cell selects that record in your table. You can then extract the field data with FieldByName or FieldValues and use that in a parameterized query. Are you doing an unprepare and prepare before opening the query? If not a parameterized query, are you clearing and adding the strings back? There are at least two ways to do what you want. If you want to post the offending code, we can look at it....can't help too much without a little more detail.
    : :
    : It is not so much a problem with the query. All that is working just
    : fine.
    : It is just when I click on DBGrid.DataSource.Dataset.First and then
    : go directly to click on DBGrid.DataSource.Dataset.Last it will not
    : take the value. I need to click on some other record in between.
    : Same for the exact opposite situation. I should be able
    : to click on the first record with not problem and then be able to click on the last record with no problem not having to select some
    : record inbetween my first and last or last and first record selection.
    : Just wondering how I can get around this little aggrivation.
    : thanks rtdvoip
    :
    :
    OK...I've never seen that problem crop up. Does it fail when you go right to the table and use its methods? I know it's supposed to be the same thing, but what happens if you do Table1.First followed by Table1.Last? Also, are you using the DBNavigator component?
Sign In or Register to comment.