Ehlib Dbgrideh affects the open method of other datasets

Source: Internet
Author: User

Dbgrideh corresponds to the dataset ADOTable1, which has a field department code, plus additional lookup fields such as Department name

ADOTable2 corresponds to the lookup dataset, which contains the department code and department name fields.

ADOTable1 Open, then run

Adotable2.close;

Adotable2.open;

after the record is not in the first one, need another

Adotable2.first;

Otherwise adotable2.eof is true

If the ADOTable1 corresponds to a normal DBGrid, then Adotable2.first is not required;

It's strange.

UnitUnit1;InterfaceusesWindows, Messages, sysutils, variants, Classes, Graphics, Controls, Forms, Dialogs, dbgridehgrouping, Toolctrlseh, Dbgridehtoolctrls, Dynvarseh, DB, ADODB, EHLIBVCL, Gridseh, Dbaxisgridseh, Dbgrideh, Stdctrls , Grids, Dbgrids;typeTForm1=class(tform) Dbgrideh1:tdbgrideh;    Adoconnection1:tadoconnection;    adotable1:tadotable;    adotable2:tadotable;    Datasource1:tdatasource;    Datasource2:tdatasource;    Adotable1name:twidestringfield;    Adotable1bmid:tintegerfield;    Adotable1bmname:tstringfield;    Button1:tbutton;    Dbgrid1:tdbgrid;    Dbgrid2:tdbgrid; procedureformcreate (Sender:tobject); procedureButton1Click (Sender:tobject); Private    {Private Declarations}   Public    {Public Declarations}  End;varForm1:tform1;Implementation{$R *.DFM}procedureTform1.button1click (sender:tobject);beginAdotable2.close;  Adotable2.open; ifAdotable2.eof ThenShowMessage ('Eof')  ElseShowMessage ('Not Eof')End;proceduretform1.formcreate (sender:tobject);beginAdotable1.open;End;End.

ObjectForm1:tform1 Left=0Top=0Caption='Form1'clientheight=281clientwidth=713Color=clbtnface Font.charset=Default_charset Font.Color=Clwindowtext font.height= - OneFont.Name='Tahoma'Font.style=[] Oldcreateorder=False OnCreate=formcreate PixelsPerInch= theTextHeight= -  ObjectDbgrideh1:tdbgrideh Left=8Top=8Width=297Height= theDataSource=DataSource1 Dynprops= <>indicatoroptions=[Gioshowrowindicatoreh] TabOrder=0    ObjectRowdetaildata:trowdetailpanelcontrolehEnd  End  ObjectButton1:tbutton Left=432Top=248Width= theHeight= -Caption='Button1'TabOrder=1OnClick=Button1ClickEnd  ObjectDbgrid1:tdbgrid Left=8Top= theWidth= theHeight= -DataSource=DataSource2 TabOrder=2Titlefont.charset=Default_charset Titlefont.color=Clwindowtext titlefont.height= - OneTitlefont.name='Tahoma'Titlefont.style= []  End  ObjectDbgrid2:tdbgrid Left=344Top=8Width=361Height= theDataSource=DataSource1 TabOrder=3Titlefont.charset=Default_charset Titlefont.color=Clwindowtext titlefont.height= - OneTitlefont.name='Tahoma'Titlefont.style= []  End  Objectadoconnection1:tadoconnection Connected=True ConnectionString='Provider=Microsoft.Jet.OLEDB.4.0;Data Source=g:\xe Projects\ehli'+'B\debug\win32\db1.mdb; Persist Security Info=false'loginprompt=False Mode=Cmsharedenynone Provider='microsoft.jet.oledb.4.0' Left=456Top= -  End  Objectadotable1:tadotable Connection=ADOConnection1 CursorType=ctstatic TableName=' Person' Left=432Top= the    ObjectAdotable1name:twidestringfield FieldName='name'Size= -    End    ObjectAdotable1bmid:tintegerfield FieldName='Bmid'    End    ObjectAdotable1bmname:tstringfield Fieldkind=fklookup FieldName='Bmname'Lookupdataset=ADOTable2 Lookupkeyfields='Bmid'Lookupresultfield='Bmname'Keyfields='Bmid'Lookup=TrueEnd  End  Objectadotable2:tadotable Connection=ADOConnection1 CursorType=ctstatic TableName='BM' Left=424Top=176  End  ObjectDatasource1:tdatasource DataSet=ADOTable1 Left=496Top= the  End  ObjectDatasource2:tdatasource DataSet=ADOTable2 Left=496Top=176  EndEnd

Ehlib Dbgrideh affects the open method of other datasets

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.