DBGridEH有关问题再请问,如何让DBGridEH里的数据自动更新显示
1个回答
展开全部
//这是使用ADO的方式。如果用UDAC 会更简单
ADODataSet1->CommandText = "SELECT A.*,B.* FROM MyTable A Left Join NextTable B";
ADODataSet1->Open();
void __fastcall TFMPersonLeave::ADODataSet1AfterOpen(TDataSet *DataSet)
{
_di_Properties p = ADODataSet1->Recordset->Properties ;
//设定删除时只作用於表
p->Item["Unique Table"]->Set_Value("MyTable");
//设定数据更改时用动态命令取回数据。
p->Item["Resync Command"]->Set_Value(
"SELECT A.*,B.* FROM MyTable A Left Join NextTable B WHERE A.ID = ?");
}
void __fastcall TFMPersonLeave::ADODataSet1AfterPost(TDataSet *DataSet)
{
ADODataSet1->UpdateCursorPos();
ADODataSet1->Recordset->Resync(1,2);
}
ADODataSet1->CommandText = "SELECT A.*,B.* FROM MyTable A Left Join NextTable B";
ADODataSet1->Open();
void __fastcall TFMPersonLeave::ADODataSet1AfterOpen(TDataSet *DataSet)
{
_di_Properties p = ADODataSet1->Recordset->Properties ;
//设定删除时只作用於表
p->Item["Unique Table"]->Set_Value("MyTable");
//设定数据更改时用动态命令取回数据。
p->Item["Resync Command"]->Set_Value(
"SELECT A.*,B.* FROM MyTable A Left Join NextTable B WHERE A.ID = ?");
}
void __fastcall TFMPersonLeave::ADODataSet1AfterPost(TDataSet *DataSet)
{
ADODataSet1->UpdateCursorPos();
ADODataSet1->Recordset->Resync(1,2);
}
推荐律师服务:
若未解决您的问题,请您详细描述您的问题,通过百度律临进行免费专业咨询