c++ builder两个ADOQuery如何关联? ( 积分: 30 )

  • 主题发起人 主题发起人 dxwwgr
  • 开始时间 开始时间
D

dxwwgr

Unregistered / Unconfirmed
GUEST, unregistred user!
急急!!!!!
后天就要交程序给使用单位,现在还有问题没解决?
两个ADOQuery关联 用BDGRID显示查询结果,从表显示不出来
程序如下
AnsiString sSql;
sSql="select * frrom Table_Test2_Quality";
F_Query->DBGrid_Test_Quality->DataSource=DataMod->DataSource_Test2_Quality;
if(DataMod->ADOQuery_Test2_Quality->Active==true)
DataMod->ADOQuery_Test2_Quality->Close();
DataMod->ADOQuery_Test2_Quality->SQL->Clear();
try
{
DataMod->ADOQuery_Test2_Quality->SQL->Add(sSql);
DataMod->ADOQuery_Test2_Quality->Open();
}
catch(...)
{
ShowMessage("操作数据库有误! ");
return;
}

sSql="select * frrom Table_Test2 where Table_Test2.Quality_ID=:Quality_ID";
F_Query->DBGrid_Test->DataSource=DataMod->DataSource_Test2;
if(DataMod->ADOQuery_Test2->Active==true)
DataMod->ADOQuery_Test2->Close();
DataMod->ADOQuery_Test2->SQL->Clear();
try
{
DataMod->ADOQuery_Test2->SQL->Add(sSql);
DataMod->ADOQuery_Test2->Open();
}
 
急急!!!!!
后天就要交程序给使用单位,现在还有问题没解决?
两个ADOQuery关联 用BDGRID显示查询结果,从表显示不出来
程序如下
AnsiString sSql;
sSql="select * frrom Table_Test2_Quality";
F_Query->DBGrid_Test_Quality->DataSource=DataMod->DataSource_Test2_Quality;
if(DataMod->ADOQuery_Test2_Quality->Active==true)
DataMod->ADOQuery_Test2_Quality->Close();
DataMod->ADOQuery_Test2_Quality->SQL->Clear();
try
{
DataMod->ADOQuery_Test2_Quality->SQL->Add(sSql);
DataMod->ADOQuery_Test2_Quality->Open();
}
catch(...)
{
ShowMessage("操作数据库有误! ");
return;
}

sSql="select * frrom Table_Test2 where Table_Test2.Quality_ID=:Quality_ID";
F_Query->DBGrid_Test->DataSource=DataMod->DataSource_Test2;
if(DataMod->ADOQuery_Test2->Active==true)
DataMod->ADOQuery_Test2->Close();
DataMod->ADOQuery_Test2->SQL->Clear();
try
{
DataMod->ADOQuery_Test2->SQL->Add(sSql);
DataMod->ADOQuery_Test2->Open();
}
 
DOQuery1->DataSource1
DOQuery2->DataSource2
DOQuery1.DataSource := DataSource2;
 
应是这样吧
ADOQuery1->DataSource1
ADOQuery2->DataSource2
ADOQuery2.DataSource = DataSource1;
 
急!!!在线等待
 
要用datasource结合AQOQUERY的参数传递
 
就没人知道我错在哪里吗
 
大问题我自己解决了,只是还有小问题,关联字段(Quality_ID)在主表中不能用中文显示('综合值系号'=Quality_ID),用中文显示就不能产生关联,是为什么?
 
后退
顶部