private void btnView_Click(object sender, EventArgs e) { string iDList = ""; if (ListObjectRelation == null || ListObjectRelation.Count == 0) { MessageBox.Show("你目前没有选中任何需要关联的对象!!", "讯息", MessageBoxButtons.OK, MessageBoxIcon.Information, MessageBoxDefaultButton.Button1); return; } else { iDList = ""; foreach (ObjectRelation oo in ListObjectRelation) { iDList += "'" + oo.RELATIONOBJECTID + "',"; } iDList = "(" + iDList.Substring(0, iDList.Length - 1) + ")"; } DataTable dtTemp = new HYDocumentMS.FileHelper().getDataTableBySql("*", " WHERE A.ID IN" + iDList, "(SELECT PRODUCTID as ID ,PRODUCTNO as NO ,[VERSION] ,'产品' as Type FROM PDM_ALL_PRODUCT UNION ALL SELECT MATERIALID as id ,MATERIALNO as NO,[VERSION] ,'材料' type FROM PDM_MATERAIL) A"); FrmShowSelectedObject FrmSelView = new FrmShowSelectedObject(); FrmSelView.DtDataList = dtTemp; FrmSelView.ShowDialog(); }